Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using openxmlpowertool for reading document file with format. It uses reference of DocumentFormat.OpenXml.dll of version 2.6.0.0 but for some functions I need DocumentFormat.OpenXml.dll of version 2.0.5022 for reference, If I add DocumentFormat.OpenXml.dll of version 2.6.0.0 it gives follwing exception

Exception in event log:

Message: 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)

Exception type: System.IO.FileLoadException Stack Trace: at CMS.ImportExport.DataExportHelper.ExportToExcel(DataSet dataSet, Stream stream) at CMS.ImportExport.DataExportHelper.ExportData(DataExportFormatEnum format, HttpResponse response)

What I have tried:

I have tried follwing bindingredirct in Web.config,

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">        
   <dependentAssembly>
    <assemblyIdentity name="DocumentFormat.OpenXml" />
    <bindingRedirect oldVersion="2.0.5022.0" newVersion="2.6.0.0"/>
  </dependentAssembly> 
</assemblyBinding>


I am not able to get publicKeyToken for the DocumentFormat.OpenXml 2.6.0 with
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC>sn -T D:\DocumentFormat.OpenXml.dll

Gives "D:\DocumentFormat.OpenXml.dll does not represent a strongly named assembly", so I have not specified
Posted
Updated 22-Aug-16 1:06am
v2
Comments
Philippe Mori 22-Aug-16 19:38pm    
You should use a single version and deploy that version. If everything matches, then it should work. Otherwise, it is probably a guess depending on how much old and new version are compatible...
InbarBarkai 24-Aug-16 2:42am    
Assembly bindings without PublicKeyToken are ignored.
What is the source of your package? I'm pretty sure the one from Microsoft NuGet Server is signed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900