所以,我知道有很多类似的问题,但在过去的一天里,我给出了很多答案,但没有任何帮助。
我正在开发一个WPF应用程序,它引用了一组外部DLL。有一个特别的动态链接库叫做DefinitionInterpreter,它已经证明会带来麻烦。在我引用的每一个项目中,它都是顽固的,并且选择不工作。我能够让它在我的单元测试套件中工作,但是,我不能让它在我的WPF应用程序中工作。
我尝试过GAC,清理我的项目,添加并删除它,重新启动,检查版本,检查依赖项,但是没有什么工作。
我一直有同样的例外:
无法加载文件或程序集“DefinitionInterpreter、Version=3.6.0.0、Culture=neutral、PublicKeyToken=null”或其依赖项之一。所定位的程序集的清单定义与程序集引用不匹配。(HRESULT例外: 0x80131040)
我尝试过在ildasm.exe中打开DLL,但它并没有显示出任何异常。它唯一的依赖项是System.Xml、System.Core和mscorlib。
当我检查清单时,它将验证版本是否为3.6.0.0
真正吸引我的是,它在我的一个项目中工作,但是我不能让它在另一个项目中工作,即使它们引用的是相同的DLL (相同的路径和一切)。
有什么建议吗?我正在使用.NET 4.0 (它是一个项目要求,它是4.0),并且已经尝试过x86和x64。
编辑:
在查看了融合日志详细信息之后,我获得了如下输出:
*** Assembly Binder Log Entry (7/18/2013 @ 7:07:42 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///E:/Src/Hermes/Tool/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = HermesClient.vshost.exe
Calling assembly : SomeAssembly, Version=13.5.13.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Src\Hermes\Tool\bin\Debug\HermesClient.vshost.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: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///E:/Src/Hermes/Tool/bin/Debug/DefinitionInterpreter.DLL.
LOG: Assembly download was successful. Attempting setup of file: E:\Src\Hermes\Tool\bin\Debug\DefinitionInterpreter.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
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.我的CSProj中的引用如下:
<Reference Include="DefinitionInterpreter, Version=3.6.0.0, Culture=neutral, PublicKeyToken=75a99a2a5bcd4c96, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\DefinitionInterpreter.dll</HintPath>
<Private>True</Private>
</Reference>执行命令sn -T DefinitionInterpreter.dll时,得到75a99a2a5bcd4c96。老实说,我不明白在运行时,它是如何认为公钥令牌是空的,以及为什么会出现不匹配。
发布于 2013-07-19 05:20:37
因此,从日志中看,"SomeAssembly“链接到该DLL的非签名版本,但所有本地版本都进行了签名。
如果您自己构建"SomeAssembly“--检查对"DefinitionInterpreter”的引用是否指向已签名的版本,否则与"SomeAssembly“实际上指的是非签名版本的ILDasm进行双重检查,并要求所有者提供另一个版本。
https://stackoverflow.com/questions/17735009
复制相似问题