Business Central OnPremise – DotNet assembly integration

 First of all it is necessary to set the target in the app.json file, in this case is target is “OnPrem” 



After this, it’s necessary to modify the settings.json of VsCode in order to integrate the paths where the dotNet assemblies reside.

Example

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

“al.assemblyProbingPaths”:[

“./.netpackages”,

“C:/Windows/assembly/”

]

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

VAR

The declaration of the VAR section becomes:


TEST CASE – “System.Datetime”

Quick test with System.Datetime located in mscorlib and System.environment




No comments:

Post a Comment