user1554876
user1554876

Reputation: 324

For IBM.WMQ .Net reference, why is my code not loading an application specific version of amqmdnet.dll?

I have a customized version of amqmdnet.dll which is referenced in my project locally AND which is deployed with the application.

This is in the logs of the server where our application runs and which interacts with IBM queues

System.IO.FileLoadException: Could not load file or assembly '' or one of its dependencies. 
         General Exception (Exception from HRESULT: 0x80131500)
         File name: 'amqmdnet, Version=7.5.0.0, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97'
            at IBM.WMQ.MQDestination.Put(MQMessage message)

However, the project file (.csproj) references a totally different version of amqmdnet.dll

<Reference Include="amqmdnet, Version=9.0.5.0, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>IBM\amqmdnet.dll</HintPath>
    </Reference>

We are wrestling with a number of questions here

Update This was due to a system issue and a restart seems to fix it. It still does not tell us why the problem occurred but it has nothing to do with amqmdnet or possibly, even the code.

Upvotes: 1

Views: 1185

Answers (1)

JoshMc
JoshMc

Reputation: 10652

Create a app.config with contents like the following to make sure the program uses a specific version of the amqmdnet.dll.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="amqmdnet" publicKeyToken="dd3cb1c9aae9ec97" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-9.0.3.0" newVersion="9.0.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

Upvotes: 1

Related Questions