Reputation: 3057
This is the case: I have a project A which has a dependency of a library version 1.0.0.0 It is crucial that this version will remain in this project. For some extra functionality I require to use the library 1.1.0.0, so I have created a class library project with the newer version and added it as a dependency to my main project. This works fine and complies nicely, but on run time I get an error:
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].
When compiling the projects as debug I do not get this error, only when compiling Release. How can I solve this issue?
Ok after activating function logging on the server I get the following error on my log:
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.
Upvotes: 3
Views: 1440
Reputation: 4172
Apparently OpenXMLReportsGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
references assembly DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
and the assembly loader cannot locate it.
Try adding this assembly to the bin folder or to the GAC.
Upvotes: 2