To accomplish interoperation from your X++ code to assemblies that are managed by the Microsoft .NET common language runtime (CLR), you must correctly store the assemblies on your client computer.
You must then reference the assemblies by AOT > References > Add reference.
These configurations enable Microsoft Dynamics AX to find the assemblies at compile time and run time.
When you write X++ code that calls into a .NET assembly, you must make sure that the X++ compiler can find the assembly. You accomplish this by the following steps on the Microsoft Dynamics AX client computer:
Copy your assembly into the client\bin\ directory under your Microsoft Dynamics AX installation directory.
Your full path might resemble C:\Program Files\Microsoft Dynamics AX\<version>\client\bin\.
Alternatively, you could copy your .NET assembly into the global assembly cache (GAC), if your assembly is signed.
- In the AOT, right-click References, and then click Add Reference.
- Click the Browse button.
- In the Select file dialog box, select your assembly file. Click Open.
You need to deploy your managed assemblies in different ways to support running on the client tier versus running on the Application Object Server (AOS) tier.
Running on the Client Tier
If your X++ method runs on the client tier, each client will need a copy of the assemblies that your code uses. Copy the assembly to the client\bin\ directory under your Microsoft Dynamics AX installation directory, or to the GAC if the assembly is signed.
Running on the AOS Tier
Your X++ code might be unable to run on the AOS tier, even though your X++ code compiles successfully on the client. A copy of each assembly that is needed by your X++ code must exist on each AOS computer for your X++ code to run on the AOS tier.
To run your X++ code on the AOS tier, you must copy your assembly to every AOS computer. The assembly can be copied into the server\…\bin\ subdirectory, which is located under the Microsoft Dynamics AX installation directory. Alternatively, the assembly can be copied into the GAC, if the assembly is signed.
Several Microsoft .NET Framework assemblies are already listed under AOT > References when Microsoft Dynamics AX is installed. This applies to both client and AOS installations.