RSS

Tag Archives: Use .Net DLL in x++

How can we use DLL in AX

If you’re using Visual Studio create a new Class Library Project. Implement whatever you need. In the Project Properties you have to sign your Assembly. Only signed Assemblies can be used in Dynamics AX. Change the Build Type to Release and build your Project. You find your DLL in your Projects bin/Release folder. Copy the DLL to the Dynamics AX Client/Bin Directory or register the Assembly in the Global Assembly Cache. Use the gacutil tool to register your Assembly in the GAC.

gacutil /i yourlibrary.dll

Open the AOT in your Dynamics AX Client.

AOT-> References Node. If you have registered the Assembly in the GAC you can choose it from the grid. Otherwise you have to provide the path. If you don’t get any errors it should work.

It is a good idea to use Code Access Permissions with CLR Interop. Otherwise you will get a Best Practice Warning see more detail from below link about this.

https://nasheet.wordpress.com/2012/04/16/error-request-for-the-permission-of-type-interoppermission-failed/

CodeAccessPermission permission;

MyLibrary.MyClass foo;

;

permission = new InteropPermission(InteropKind::CLRInterop);

permission.assert();

foo = new MyLibrary.MyClass();

 

Tags: , , , , , , , ,