Skip to main content

Notifications

Microsoft Dynamics AX (Archived)
Suggested answer

Registering .Net library for calling from X++

(0) ShareShare
ReportReport
Posted on by 120

Hi All,

We are facing a deployment question while registering a .Net dll for consumption from X++ in Dynamics AX 2012. 

We have a central AOS server and all users are accessing using AX clients from different machines. We have created a custom .Net dll. In order to register we go to AX Client of developer -> AOT -> References and then browse the dll. The browser opens the Dynamics Client\Bin directory on the AX Client machine. So it seems the dll needs to be present on the Client\Bin directory of local AX installation on the machine where Client is loaded and not the main AOS server. So if there are 10 users using the application who need to be accessing the dll functionality from X++ code from their AX Client, it seems all the 10 users need to  have the dll locally present in their Client\bin folder. 

This seems not right to me, because ideally having the dll centrally on the AOS server machine and referencing from there should have been enough. But that is not happening because then the code doesn't compile in the client machines.

Can some please advice me on the right way to register a .Net dll for a Dynamics AX 2012 application?

Regards

Shas

*This post is locked for comments

  • Suggested answer
    Joris dG Profile Picture
    Joris dG 17,775 on at
    RE: Registering .Net library for calling from X++

    So, location of the DLL depends on the usage of course. If the code using the DLL runs server side, you only need it on the AOS. If you need it on client, you need it on client, and of course if you're doing both you need the DLL on both.

    That being said, the reference you add could come from anywhere. It doesn't matter where you point the reference to, it will just pick up the assembly information. So in reality, the client would need the DLL any place the framework or AX will look for it. The folder of the executing process is always the default location to look for a dll (for AX, client/bin) but you could also place the DLL in the GAC. Additionally, AX will also look for DLLs in the user's %USERPROFILE%\AppData\Local\Microsoft\Dynamics AX\VSAssemblies folder (this is technically for VS AOT projects as I described here: daxmusings.codecrib.com/.../ax-2012-net-assembly-deployment.html ) so you could deploy DLLs there for each user if you want.

    If you want to auto-deploy DLLs automatically, I've been blogging about this recently. There are two ways, one officially supported, one somewhat of a hack. Unfortunately the hack-way works better :-)

    daxmusings.codecrib.com/.../auto-deploying-dlls-and-other-resources.html

    daxmusings.codecrib.com/.../auto-deploying-dlls-and-other-resources.html

    Part 2 for the "official" deployment will be up in the next few days at the latest.

    As for compiling, you'll always want to compile from one machine that has all the DLLs needed (i prefer from a box that even has SSRS/SSAS/SharePoint assemblies so there are no warnings anywhere in the compile).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans