web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Failed to load assembly error when trying to use .NET assembly in AX 4.0

(0) ShareShare
ReportReport
Posted on by 11,633

Hi All,

I am trying to use .NET assembly in AX 4.0. I have imported the .NET assembly reference from XPO file and it imported successfully and showing under AOT->References node. I have added the .NET assembly in GAC on both client and AOS machines. But I am unable to use it in X++ code and getting compile errors "The table does not contain this field". I am using the fully qualified name like namespace.classname. Also, when I try to compile the whole project, I am getting error "Failed to load assembly". I have verified all the attributes of the assembly showing in AX and GAC and all are same. Can anyone please let me know what I might be missing here?

Thanks.

*This post is locked for comments

I have the same question (0)
  • syed baber Profile Picture
    11,633 on at

    The .NET assembly reference has been added on USR layer.

  • Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    Was the assembly built for the right version of .NET (I think it should be .NET 2.0 in this case) and processor architecture (Any CPU or x86)?

  • syed baber Profile Picture
    11,633 on at

    Hi Martin,

    Assembly has been built with .NET version 2.0 and process architecture is showing as MSIL.

  • Suggested answer
    Martin Dráb Profile Picture
    237,795 Most Valuable Professional on at

    The problem may be in a dependency - review that all libraries needed by your assembly have been installed too.

    If it doesn't help, use Assembly Binding Log Viewer.

  • syed baber Profile Picture
    11,633 on at

    Hi Martin,

    I managed to get it working by adding the reference in AX 2009 and import it back in AX 4.0, but in AX 4.0, now I am getting error that "The class "xx" does not contain this function, when I am trying to call the method showing in the drop down. What could be the problem here. What I need to change related to this method in .NET?

  • syed baber Profile Picture
    11,633 on at

    I got it resolved. I was not passing the correct number of arguments in the method, so it was complaining that the method not found contrary to X++ in which case we get the errors Argument "xx" is incompatible with the required type. When calling a method inside a dll, it was trying to find the overloaded version of the method because of different number of arguments in the method.

    Thanks,
    Baber.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans