我正在尝试降级 NServiceBus 依赖项,而不是使用 4.0.0.0 来使用 2.5.0.0
我正在尝试以下方法,但似乎都不起作用。
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NServiceBus"
publicKeyToken="9fc386479f8a226c" culture="neutral"/>
<bindingRedirect oldVersion="4.0.0.0" newVersion="2.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
我也试过代码库:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NServiceBus"
publicKeyToken="9fc386479f8a226c"
culture="neutral"/>
<codeBase version="2.5.0.0" href="NServiceBus.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
仍然,虚无。我浏览了 msdn 文档,但没有提及以向后方式使用此功能。这可能吗?
最佳答案
我实际上将您的第一个语句用于某些互操作 DLL,因为我们公司的客户在办公室更新方面有不同的状态。这是我使用的代码:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="office" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
这提供了从 DLL 版本 14 到版本 11 的向后兼容性。你能提供你正在使用的 DLL 的链接吗?
我已经下载了 NServiceBus 框架(版本 3.3.8)并使用 ILSpy 研究了 DLL。我建议你对你的 DLL 做同样的事情。对于我的 DLL,它向我显示了与您相同的公钥 token 。您确定您使用的是 4.0.0.0 版而不是 3.3.0.0 版吗?或者您可能不匹配公钥 token 。
关于c# - 程序集绑定(bind)重定向到较低版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17092928/