Runtime Packages for Dynamics 365 Business Central On-Premises (Protect the intellectual property represented by your AL source code)

Dynamics 365 Business Central

Hi, Readers.
Last year we have discussed how to prevent users from downloading source code of PTE in Dynamics 365 Business Central, today I would like to talk a little more about Runtime Packages for Business Central On-Premises.

First of all, if you share app files with Partners or customers, please note that app files can be extracted.

You can get all the al files from the src folder.

So when you send app files to customers or partners and don’t want them to see the source code, what should you do?

Actually, if you want to distribute extensions, you can generate runtime packages that do not contain AL code, but only the final artifacts used by the server at runtime. Runtime packages thereby allow you to protect the intellectual property represented by your AL source code.

When the runtime package is generated on the server, the developer license is checked for permissions to the used extension IDs. The extension in a runtime package can then be installed on servers that do not have a developer license; the server only needs permissions to run the objects, but not to modify or insert them.

Using runtime packages

The first step in using runtime packages is to have an extension developed and published to an on-premise instance, so you need to install an On-Premises version of Business Central.
For example, BC18.x: Released Updates for Microsoft Dynamics 365 Business Central 2021 Release Wave 1

Next, use the following PowerShell command to connect to the server, find the extension, and download the runtime package.


Therefore, you need to publish the extension first, and then run the above command.

Let’s see more details.

1. Run Business Central Administration Shell as administrator.

2. Publish the app to BC on-premise instance.

Publish-NAVApp -ServerInstance BC184 -Path "C:\Users\yzhu\Documents\AL\IntegrationWithDataverse\IntegrationWithDataverse\ZHU" -SkipVerification

Installation is not required.

3. Run Get-NavAppRuntimePackage command.

Get-NAVAppRuntimePackage -ServerInstance BC184 -AppName 'IntegrationWithDataverse' -Version -Path 'C:\Users\yzhu\Documents\AL\IntegrationWithDataverse\IntegrationWithDataverse\ZHU'

The runtime package will be generated automatically.

Test Video:


The limitation of runtime packages is that they only work for on-premise installations and therefore cannot be submitted to AppSource. For more information about the extension requirements for AppSource, see Technical Validation Checklist. Moreover, debugging into an extension to view the source code is not allowed by default; the ShowMyCode flag is by default set to false.

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

If you set the ShowMyCode flag to true when running the Get-NavAppRuntimePackage cmdlet, you can enable debugging and you thereby also allow viewing the source code.

If you try to install a runtime package in the BC SaaS environment, you will get the following error.

Deployment failed. Errors: App ID : fa3eba4c-e067-4665-9e18-23870f779691 Message : { File contains corrupted data. } – Job Id : 6f3c5b16-c09e-4dd2-b956-0266a558a884


Hope this will help.

Thanks for reading.