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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

(0) ShareShare
ReportReport
Posted on by 3,850


Hello. I'm writing a services, like this in the code below:

I have several problems:

  1. First I wrote a class.
    1. Empty Class Decleration.
    2. Just this method getinfo(Args _args).
    3. Empty main(Args _args) method

I compiled the class with no main method (because static method can act as an service, and got error about the class should have a main method. So I added EMPTY main(Args _args) method.

I cimpiled again and got Warning: MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Microsoft.Dynamics.AX.ManagedInterop", "x86". This mismatch may cause runtime failures. Please consider changing. I think that's a minor error because I'm use a Remote Desktop Connection to the AX2012R3VMA server (the A server). But I don't know if I need to fix that Warning - if so, I can't get any informaton about that in user forums, all the people say it's just normal Warning because you are on a server on x64.

So, with empty Class Decleration, and empty main method I run the class and No Errors. But no infolog appeard - what do I need to do there to make the infolog appear - call the static method from another class?

Well I though let's try to copy the code to job with the same name "getInfo" and the Job as also with no error. I compiled it and also everything is OK. But when I ran the Job I got this error: Assembly containing type My_NameSpace1.Client is not referenced.


I tried to look on forums and read about hotwapping configuration, compile full or/and incremental CIL, restart AOS and check if the .dll file does exist both in the Client URL and Server URL. But Notice I'm just working on the demo Server.

Client URL: C:\Users\[username]\AppData\Local\Microsoft\Dynamics Ax\VSAssemblies{2F8DEE4C-881F-4848-BA09-72758B1ADA6D}

Server URL: C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\VSAssemblies


But Notice I see the GUID ID {2F8DEE4C-881F-4848-BA09-72758B1ADA6D} who is not as I have seen it in another forums, but we are two persones who use Remote Desktop Connection to that server  through Terminal License.

 

Here is the code, and notice also that I have check Add reference to the System.ServiceModel.

According to the last error I need to get a reference to My_NameSpace1 - but how can I do that?


Any ideas of soltuions?

static void getInfo(Args _args)

{

   // Vars from .NET Project C#

   My_NameSpace1.Client       client;

   My_NameSpace1.GetSetInfo   getInfo;

   My_NameSpace1.GetSetInfo setInfo;

 

   // System vars,

   //I have previosly went to AOT-Reference-Node-Add-Reference and select System.ServiceModel, and choose OK

   System.ServiceModel.Description.ServiceEndpoint endpoint;

   System.ServiceModel.EndpointAddress             endpointAddress;

   System.Exception                              exception;

   System.Type                                     type;

   ;

 

 

   try

   {

       type = CLRInterop::getType('My_NameSpace1.client');

       client = AifUtil::createServiceClient(type);

endpointAddress = new System.ServiceModel.EndpointAddress("https://test.ausVATagency.au.com/WS/VATService.svc");

 

       // Set endpoint, and endpoint address.

       endpoint = client.get_Endpoint();

       endpoint.set_Address(endpointAddress);

 

       //setInfo to parameter;

       setInfo.set_ID("1234567890");

       setInfo.set_version("9600");

       setInfo.set_key ("XXXXXXX");

 

       //get info back;

info (strFmt("%1, %2, %3, %4, %5", getInfo.get_ExtensionData(), getInfo.get_Amount(), getInfo.get_ListOfRec(), getInfo.get_Succseed(), getInfo.get_errors()));

   }

  

   //Typical error handling.

   catch (Exception::CLRError)

   {

       // Get the .NET Type Exception

       exception = CLRInterop::getLastException();

 

       // Go through the inner exceptions

       while (exception)

       {

           // Print the exception to the infolog

           info (CLRInterop::getAnyTypeForObject(exception.ToString()));

 

           // Get the inner exception for more details

           exception = exception.get_InnerException();

       }

 

 

   }

 

 

}

 

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    You declared a variable of type My_NameSpace1.Client which, as you said, compiles without issues. But you're trying to find the type My_NameSpace1.clientsensitive, therefore Client and client are two different names. This inkonsistence can't be correct.

    About the Main() method, you probably used a template for an executable application, which obviously requires something to execute. Open your project properties and change Output Type to Class Library.

  • Sandri Profile Picture
    3,850 on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    Hi Martin.

    When I copy the code to the board, I need to change the names so the class can't be traceable, I used find and Replace - so in that action maybe the My_NameSpace1.client have been affected wth that replace action, and original code can be right My_NameSpace1.Client (with capital C)

    I canðt access the server from home, but I'm wery keen to see if that is the error, but if the original code is My_NameSpace1.Client what else can be wrong, can you possible see something else?

    is the GUID suffix on the VSSASsembly URL the error?

    Can the error be something about Generate CIL - Compile, or something else? Does it have something todo with the Terminal session uses?

  • Sandri Profile Picture
    3,850 on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    I wento to work - you are amazing, that was right - I needed to fix the line from My_Namespace1.cleint to My_NameSpace1.Client.

    After I fixed it in Job - i got the classic error: CLRObject object not initialized.

    Is the rason that I need to restart the AOS and Compile - or deploy again?

  • Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    You would have to collect more information about the error, especially where it's thrown.

    The GUID in VSAssembly folder name is AOS ID; nothing to worry about.

    Regarding CIL - you don't run your code in a CIL session, so it's not related.

    Regarding AOS - if you run your code directly in a job, it's executed on client.

  • Sandri Profile Picture
    3,850 on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    Hello Martin

    The error is in this line:

    setInfo.set_ID("1234567890");

  • Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    You try to call a method and AX complains that the object is not initialized. You should immediately go and review/debug how you're initializing it. You would quickly find that you never assign any instance to setInfo, therefore it's always null.

    You should be able to debug such things by yourself.

  • Sandri Profile Picture
    3,850 on at
    RE: WebServices .NET - two errors: MSB3270 Mismatch (x86) and Assembly containing type {...} is not referenced.

    Hello Martin - thanks for all your help.

    Of course I need to initialize it as well, but I will be little bit confused when I have read the same code all the day - then I can't notice obviosly errors like this.

    But after I have configure the code like you told me I got error about "Not marshalling through code"

    You can find the question on this URL: community.dynamics.com/.../136554.aspx

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans