This post is machine-translated. The original post in german language can be found here.
These post applies to following versions:
Dynamics AX 2012, Dynamics AX 2009
Dynamics AX 2012, Dynamics AX 2009
|
|
|
|
|
|
This post is machine-translated. The original post in german language can be found here.
These post applies to following versions:
Dynamics AX 2012, Dynamics AX 2009
|
To use a DLL in Dynamics AX, the DLL must be added to the References node of the AOT.
This can be achieved by right-clicking on the node and select Add Reference. This opens a dialog where - depending on the "location" of the DLL - the following steps must be taken:
To register a DLL in the GAC, it is necessary that the DLL has been signed.
They can be achieved via the command line using the following command
"gacutil / i MyClassLibrary.dll"
In both cases, the dialog needs to be confirmed with OK.
From this point, the DLL can be addressed as follows:
{
MyClassLibrary.MyExampleClass myClass;
new InteropPermission(InteropKind::CLRInterop).assert();
myClass = new MyClassLibrary.MyExampleClass();
info(myClass.ExampleString());
}
The DLL used in the example looks as follows:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyClassLibrary
{
public class MyExampleClass
{
public string ExampleString()
{
string myString = "Hello World!";
return myString;
}
}
}
Info in MSDN:
How to sign an Assembly
http://msdn.microsoft.com/en-us/library/ms247123(v=vs.90).aspx
How to install an Assembly into the Global Assembly Cache
http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx