Business Central OnPremise – DotNet assembly integration in Microsoft AL
Business Central OnPremise – DotNet assemby integration in Microsoft AL
This short post to show you how to use DotNet assemblies in Business Central OnPremise, it might be useful to declare and use them in Microsoft AL.
First of all it is necessary to set the target in the app.json file, in this case is target is “OnPrem” (for Cloud (for Cloud/SaaS I will test Blazor shortly in a future post)
After this, it’s necessary to modify the settings.json of VsCode in order to integrate the paths where the dotNet assemblies reside.
File – Preferences – Settings – Extensions – AL Language Extension
Select “Modify in settings json”
In this “SETTINGS.JSON” file, you need to insert the assembly path for assembly reference
Once this is done, it’s necessary to declare in our .AL file which assemblies to load
example: ASSEMBLY name: “mscorlib”
As a result we will have (at the beginning of our AL script)
…and so on for all the DotNet libraries to use
The declaration of the VAR section becomes:
TEST CASE – “System.Datetime”
Quick test with System.Datetime located in mscorlib and System.environment