我已经尝试解决一个程序集绑定问题长达12个小时,但没有太大的进展。上周,我将解决方案中所有项目从EF 4.1.0.0升级到EF 4.3.1.0。今天早上,我在现有测试项目中添加了一些测试,对整个解决方案进行了清理和重新编译。所有项目都可以编译而且没有警告或错误。但是,当我在项目的任何地方调用实体框架时,我会收到以下异常:
初始化方法NutricityPPCTests.Common.DizzleProductExtensionsTests.TestSetup抛出异常。System.IO.FileLoadException: System.IO.FileLoadException:文件加载失败:Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. 找不到文件指定的模块。 (Exception from HRESULT: 0x80131040)
我启动了Fusion程序集绑定日志查看器,并找到与异常相对应的日志条目。我已验证我的测试项目和MOMData项目都引用了正确的EF 4.3.1.0程序集。我还验证了项目文件中没有对EF 4.1.0.0的任何引用。我删除了两个项目的obj和bin目录中的内容。由于该项目已经被多次清理和重建,我的硬盘可能会在明天崩溃。
*** Assembly Binder Log Entry (3/22/2012 @ 5:55:11 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NUTRICITY0\awolske
LOG: DisplayName = EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = QTAgent32.exe
Calling assembly : MomData, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\NutricityPPCTests.DLL.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release/EntityFramework.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\EntityFramework.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
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.
我还应该在哪里寻找旧的引用程序集?!?任何帮助都将受到欢迎并非常感激!提前感谢您的时间!