2

我正在重定向 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 是新版本。有人可以告诉这里可能是什么问题吗?非常感激。

4

0 回答 0