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

1

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

  • In the server logs why is the version number of amqmdnet dll showing up as 7.5.0.0 with the same public Key token even though we have version 9.0.3.0 deployed ? There is no IBM client installed on the server (it is a barebones Azure container).
  • The exception is thrown ONLY when the Put method is called. Before that a whole lot of initialization happens without a problem eg. initialization of MQQueue objects and so on. Why is the Put method of the correct assembly (9.0.3.0) trying to call a method from a different assembly version (7.5.0.0) ?

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.

.net
ibm-mq
.net-assembly
assemblies
asked on Stack Overflow Oct 30, 2019 by user1554876 • edited Nov 6, 2019 by user1554876

1 Answer

1

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>
answered on Stack Overflow Nov 1, 2019 by JoshMc

User contributions licensed under CC BY-SA 3.0