In this post I will show how to use dotnets in Business Central On Premise. Keep in mind that dotnets are only allowed for On Premise and not for Saas. It might be particularly helpful if your are migrating from an older version of Nav and you want your dotnets to continue working in Business Central On Premise without rebuilding your .dll file.
For this example I will show a .dll that calculates a random number for a specific funcionality and how can we invoque it and use it.
Target and placing the .dll file
First, the target must be set to ‘OnPrem’ on the launch.json:
Second, set the assembly proving paths property on settings.json:
Place the .dll file in the path and in the root of Business Central. We have created the ‘Assemblies’ and ‘DLLTest’ folders for that purpose:
Third, restart the Instance with the Business Central Administration tool.
Build the dotnet
Build the dotnet in a .al file as the following. The assembly name must be the name of the .dll file and the type name must be the name within the .dll method you wish to use:
Once Visual Studio identifies the .dll (you might need to reload Visual Studio) you can access its methods.
You can now work with it as you would in your older versions and try the functionality:
Hope you find it useful.