2012-12-10 73 views
3

这样的话:我有有一个库版本的依赖关系1.0.0.0 至关重要的是,这个版本将保持在一个项目这个项目。对于一些额外的功能,我需要使用库1.1.0.0,所以我创建了一个更新版本的类库项目,并将它作为依赖添加到我的主项目中。 这工作得很好,也很符合,但在运行时我得到一个错误:添加一个项目,一个依赖V1到一个项目,一个依赖V1.1

System.IO.FileLoadException: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 
File name: 'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 
    at OpenXMLReportsGenerator.GenerateInvoiceFailureReportHEOpenXML.CreatePackage(String filePath, DataSet data, String exporterName) 
    at bDoxWebEd.Reports.InvoiceFailureReportHandler.BeginGenerateReportAndSave(Object gerateReportStateInfo) 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

当编译项目,调试我没有得到这个错误,只有编译时发布。 我该如何解决这个问题?

我得到我的日志中出现以下错误的服务器上激活功能登录后确定:

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Windows\SysWOW64\inetsrv\w3wp.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: User = IIS APPPOOL\bDoxPool 
LOG: DisplayName = DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
(Fully-specified) 
LOG: Appbase = file:///D:/***/ 
LOG: Initial PrivatePath = D:\***\bin 
Calling assembly : OpenXMLReportsGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: D:\Program Files\Nipendo\bDox\bDox\web.config 
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Post-policy reference: DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/bdox/00aaf85b/66058ca1/DocumentFormat.OpenXml.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/bdox/00aaf85b/66058ca1/DocumentFormat.OpenXml/DocumentFormat.OpenXml.DLL. 
LOG: Attempting download of new URL file:///D:/***/bin/DocumentFormat.OpenXml.DLL. 
WRN: Comparing the assembly name resulted in the mismatch: Build Number 
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 
+1

其次关于如何启用绑定日志记录消息的结束的指令。然后使用Fuslogvw.exe检查失败的绑定。 –

+0

这只发生在生产环境中,所以我无法从cmd访问Fuslogvw.exe。 – AMember

+1

您可以将Fuslogvw.exe复制到生产计算机。如果它不直接合作,遵循http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx指令将其打开。 –

回答

2

显然OpenXMLReportsGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null引用组装DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 和组件加载器无法找到它。

尝试添加该组件到bin文件夹或GAC。

+0

我不能,因为我需要在bin用于其他用途的旧版本.. – AMember

+1

@AMember,那么你可能需要将组件添加到GAC。你不能更新你的问题关于这些程序集的更多细节。指定组件和他们的全名(如DocumentFormat.OpenXml,版本= 2.0.5022.0,文化=中性公钥= 31bf3856ad364e35)和它们的依赖关系(引用的程序集)。也让我们知道哪些程序集是您自己的,哪些是第三方的。 –

+0

我已经设法通过更新所有我的envs的版本来解决问题。感谢您的帮助...... – AMember

相关问题