绑定重定向

时间:2014-12-11 12:13:42

标签: c# dll ionic-framework assembly-binding-redirect

需要从我的一个项目中引用库'configit.Base.dll'。不幸的是我的项目已经使用Ionic.Zip.dll版本1.9.3.0,它看起来像configit.Base.dll需要Ionic.Zp.dll版本1.9.1.8,所以当我尝试运行我的程序时,我收到一个加载错误。 我试图将以下内容添加到mu .config文件中:

  <dependentAssembly>
    <assemblyIdentity name="Ionic.Zip" publicKeyToken="edbe51ad942a3f5c" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.9.1.8" newVersion="1.9.3.0" />
  </dependentAssembly>

没有任何成功。 如果我运行fuselogwv,我会得到以下内容:

=== Pre-bind state information ===
LOG: DisplayName = Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
(Fully-specified)
LOG: Appbase = file:///C:/Local/Projects/Playground/ConfigItLoad1/ConfigItLoad1/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ConfigItLoad1.exe
Calling assembly : Configit.Base, Version=2.0.0.111, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Local\Projects\Playground\ConfigItLoad1\ConfigItLoad1\bin\Debug\ConfigItLoad1.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Local/Projects/Playground/ConfigItLoad1/ConfigItLoad1/bin/Debug/Ionic.Zip.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Local\Projects\Playground\ConfigItLoad1\ConfigItLoad1\bin\Debug\Ionic.Zip.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Ionic.Zip, Version=1.9.3.0, Culture=neutral, PublicKeyToken=null
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

这是否意味着Ioniz.Zip 1.9.3.0与1.9.1.8如此不同,以至于无法加载?

TIA

/索伦

2 个答案:

答案 0 :(得分:0)

这并不意味着Ioniz.Zip 1.9.3.0与1.9.1.8如此不同,无法加载。

以下行表明未发生绑定重定向:

LOG: Post-policy reference: Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c

确保您的配置条目格式正确(MSDN)并位于

C:\Local\Projects\Playground\ConfigItLoad1\ConfigItLoad1\bin\Debug\ConfigItLoad1.exe.Config

或您的machine.config。

答案 1 :(得分:-2)

签入CSPROJ文件。如果指定了任何版本,请将其删除。