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.
When you try to convert existing C/Side objects to AL the first attempts are typically done while scoping OnPrem. This gives an overview of the errors to be fixed w.o things like DotNET.
In this phase you typically switch between C/Side and Visual Studio Code all the time fixing the errors one-by-one and reconverting.
During the year, I have rolled up to several of the Dynamics NAV 2018 cumulative upgrades implementing new functionalities and unfortunately also fixed multiple errors in the standard application.
Upgrading to Dynamics NAV 2018 CU 5: the sales lines started to give the error: Another user has changed the sales line. Just entering the Line Type, The Item No. and the Unit of Measure code. Therefore, entering a line you needed to leave the document window and reenter to continue.
Finally Extensions V2 supports DotNet (At least in the Developer Preview.
But as soon as you fire this up, perhaps with the help of TXT2AL, you’re met with assemblies not resolved. Both assemblies from standard DotNet (from the global assembly cache) and standard NAV DLLs.
When developing Extensions for NAV, using the Modern Development Environment in Visual Studio Code, you cannot use .Net Interoperability. See this link if you want to read more about this subject.
So if you have NAV developments that use .Net and you want to move them into Extensions you will probably need to replace the logic implemented using .Net with something else.