Bearbeiten

Create runtime packages for Business Central on-premises

By default, runtime packages omit AL source code and contain the emitted artifacts used by the server. You can explicitly include source when generating a package. Runtime packages thereby allow you to protect the intellectual property represented by your AL source code.

The server where you generate the runtime package must have a developer license with permissions for the extension's object IDs. The extension in a runtime package can then be installed on servers that don't have a developer license. The consuming server's license must allow the objects to run, but it doesn't need developer object-range rights to publish the runtime package.

Start using runtime packages

The first step in using runtime packages is to have an extension developed and published to an on-premises instance. Next, use the following PowerShell command to connect to the server, find the extension, and download the runtime package.

Get-NavAppRuntimePackage

Learn more about this cmdlet in Get-NAVAppRuntimePackage cmdlet.

The following example gets the NAV App runtime package with the provided name and version.

Get-NAVAppRuntimePackage -ServerInstance DynamicsNAV -AppName 'Proseware SmartApp' -Version 2.3.4.500 -Path 'Prosware SmartApp_2.3.4.500_runtime.app'

For publishing and installing the package, use the Publish-NavApp and the Install-NAVApp PowerShell cmdlets.

Upgrade considerations

Like any extension, extensions distributed in runtime packages will occasionally have to be upgraded so that they can run with the latest Business Central version. There are two ways to upgrade a runtime package. Each way provides a different level of upgrade.

Create a new extension version and runtime package

The recommended way to upgrade a runtime package is to build a new version of the extension against the latest platform and application. Then, publish the extension to an on-premises instance, and create a new runtime package version for distribution. Once you have the package, you can then publish it on tenants, and run a data upgrade like with any other extension.

Recompile the existing package

Another way to upgrade the package is to use the Repair-NAVApp cmdlet to recompile the published package against the new platform and Business Central server instance. Once compiled, you can reinstall the package on the tenant. Using the Repair-NAVApp cmdlet doesn't guarantee that the extension works properly. It's not recommended when upgrading to a new version.

The Repair-NAVApp cmdlet requires that the runtime package includes the source code. Source inclusion and source exposure are separate settings:

  • Run Get-NAVAppRuntimePackage with -IncludeSourceInPackageFile $true to include AL source in the runtime package. The -ShowMyCode $true parameter is a legacy alternative for source inclusion.
  • In app.json, resourceExposurePolicy.allowDownloadingSource controls whether included source can be downloaded. The legacy showMyCode setting also concerns source exposure. These manifest settings don't by themselves include source in the runtime package.

Limitations

The limitation of runtime packages is that they only work for on-premises installations, so you can't submit them to Marketplace. Learn more about the extension requirements for Marketplace in Technical validation checklist. Moreover, debugging into an extension to view the source code isn't allowed by default; the allowDebugging flag is by default set to false. Learn more in Resource exposure policy setting.

Note

Runtime packages are guaranteed to work only if published to a platform with the same version as the one where they were produced.

Note

Get-NAVAppRuntimePackage -ShowMyCode $true includes source in the runtime package. To debug into the extension, also configure resourceExposurePolicy.allowDebugging appropriately.

Publish-NAVApp cmdlet
Install-NAVApp cmdlet