Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Issue while using .Net DLLs in AX 2012

(0) ShareShare
ReportReport
Posted on by 10,794 User Group Leader

Hi Guys,

I created a class library project in Visual Studio 2010 and have already deployed it. It created .dll files in %USERPROFILE%\AppData\Local\Microsoft\Dynamics AX\VSAssemblies folder. Till now works fine!

I set following properties while deploying VS project and save to AOT.

Deploy Client = Yes
Deploy Server = Yes

This is how project (class library looks like)

1805.AOTJob.png

I created a job within AOT and tried to call this class library but it did not get recognized in AX.

This is how I am using it in a job

I have already copied .pdb and .DLL files again from Visual studio project folder into %USERPROFILE%\AppData\Local\Microsoft\Dynamics AX\VSAssemblies.

Can anyone please tell me what step I am missing as I have followed all the steps defined on this thread.

AOS server has also been restarted and Hotswapping is also enabled on server (I know its not good to enable it but its just testing purpose.)

Any help or any pointer will highly be appreciated.

*This post is locked for comments

  • dolee Profile Picture
    dolee 11,279 on at
    RE: Issue while using .Net DLLs in AX 2012

    Recently, I have to do something similar... a binary that is to be run in batch.

    I needed to compile the assembly for "Any CPU" in order to:

    - Have the assembly show up and compile correctly in client X++ editor, and

    - have the batch job run properly.

  • Verified answer
    skaue Profile Picture
    skaue on at
    RE: Issue while using .Net DLLs in AX 2012

    Ok. First of all, when writing X++ code that refers .Net assemblies or simply compiling X++ code that refers .Net assemblies, this will only work if those .Net assemblies are available client side. This means you need to make sure they are in the scope of the AX Client.

    The scope is limited to :

    * Global Assembly Cache (GAC). Example look under \windows\assembly\

    * Client bin folder. Program Files (x86\....Client\bin\

    * Your own users VSAssembly hive. %appdata%\..\Local\....\VSAssembly

    This scope gets refreshed and reloaded when the Client starts, each time, to the best of my knowledge.

    This is all good when writing the code, getting intellisense, compiling and everything looks good.

    However, if the code is actually supposed to run server side (by the AOS), then it *also* needs to be in the scope of the AOS:

    * GAC

    * Server bin folder. \Program Files\....\Server\YOURAOS\bin\

    * Server VSAssembly-folder. Same as above, but with VSAssembly at the end. ;-)

    This scope gets refreshed when the actual AOS Service gets restarted. The only exception is any assemblies in the VSAssembly folder *IF* "HotSwap assemblies" is enabled on the AX Service Configuration. Do not enable this setting in Production, but if you are the only developer on this AOS, feel free to enable it while developing your assembly. Not sure when it gets reloaded, but my guess is when the project is compiled in Visual Studio.

    So think about where the code/assembly is being loaded/picked up, and think about scope. I would recommend to avoid having the dll both in the root bin folder *and* the VSAssembly folder. I'm not sure what version of the dll it will pick up first and give precedence over the other.

    :-)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Issue while using .Net DLLs in AX 2012

    Check if all things are public in your visual Studio development. I can see at least the enums are not public, maybe this causes ax to fail here?

  • skaue Profile Picture
    skaue on at
    RE: Issue while using .Net DLLs in AX 2012

    Check one more thing; do you have one dll in the root folder of your bin-folder (Client), and another one in your Assembly folder (..\AppData\Local\Microsoft\Dynamics AX\VSAssemblies\)?

    Make sure things doesn't get mixed up by two different versions being picked up by the client. If you find only one dll, try "peek" inside of it using Jetbrains dotPeek (Bing it) and make sure it is the latest and most correct build.

  • Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Issue while using .Net DLLs in AX 2012

    Mukesh,

    Can you please tell me where should I see these configuration issues? I mean where and what I can double check?

  • MukeshHirwani Profile Picture
    MukeshHirwani 1,180 on at
    RE: Issue while using .Net DLLs in AX 2012

    Faisal,

    try on other machine.. it works perfectly in d same manner... might b dr is some issue wd ur configuration.

  • Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Issue while using .Net DLLs in AX 2012

    Hi Tommy,

    How can I confirm this point "unless you have a mix of environments here, and things are being deployed to a different AOT, and not the one you are trying to consume the assembly from"?

    I Edit visual studio project from AOT and deployed it. Later I deleted .DLL file and comiled the visual project from AOT itself and it generated .DLL files.

  • Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Issue while using .Net DLLs in AX 2012

    Assemnly has been compiled and it is showing in AOT.

    No I am not getting intelligence in X++ I am getting upto ImageResize.ImageResize which is Namespace.ClassName in .Net. I am not able to create any object for this class in order to access Class method in my case it is FixedSize().

  • Faisal Fareed Profile Picture
    Faisal Fareed 10,794 User Group Leader on at
    RE: Issue while using .Net DLLs in AX 2012

    Hi Mukesh, Yes I deployed it and I have checked DLL files created in my %USERINFO folder its there.

  • Suggested answer
    skaue Profile Picture
    skaue on at
    RE: Issue while using .Net DLLs in AX 2012

    Let me get this straight. Your assembly is compiled and available in X++?

    Do you get intellisense when you start typing the namespace?

    The article you have linked to sort of says it all. This should work, unless you have a mix of environments here, and things are being deployed to a different AOT, and not the one you are trying to consume the assembly from.

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…

Vahid Ghafarpour – Community Spotlight

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

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,399 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans