2012-12-10 117 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

相關問題