我正在重定向app.config中的依赖程序集版本,并通过以下配置从指定位置加载dll -
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myassembly" culture="neutral" publicKeyToken="ksjdksjdskdjkdjskdjs"/>
<bindingRedirect oldVersion="1.11" newVersion="1.22"/>
<codeBase version="1.22" href="file://C:/libs/myassembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
在绑定日志中,它似乎按预期重定向版本,但随后与旧版本进行比较并失败:
LOG: Redirect found in application configuration file: 1.11 redirected to 1.22.
LOG: Using codebase from policy file: file:///C:/libs/myassembly.dll.
LOG: Post-policy reference: myassembly, Version=1.22, Culture=neutral, PublicKeyToken=ksjdksjdskdjkdjskdjs
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/libs/myassembly.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\libs\myassembly.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: myassembly, Version=1.11, Culture=neutral, PublicKeyToken=ffbc9a05441709bc
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
我已经验证了C:/libs/myassembly.dll是新版本。有人可以告诉我这里可能出现什么问题吗?非常感谢。