我有一个定制版本的amqmdnet.dll,在我的项目中本地引用了该版本,并与应用程序一起部署。
这是在运行我们的应用程序并与IBM队列交互的服务器的日志中
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)
但是,项目文件(.csproj)引用了完全不同的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>
我们在这里要解决许多问题
创建具有如下内容的app.config
,以确保程序使用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>