Spreadsheetlight is a dotnet library for creating Excel documents with all it’s wonderful features. The Spreadsheetlight nuget has no dependencies on nuget packages, but does have a dependency on Open XML SDK 2.0. This can be installed with the DocumentFormat.OpenXml 1.0.0 nuget.
But after a while everything stopped working, because you tried updating the DocumentFormat.OpenXml to the latest version 2.5.0.
An unhandled exception of type ‘System.TypeLoadException’ occurred.
Additional information: Could not load type ‘DocumentFormat.OpenXml.Spreadsheet.SmartTags’ from assembly ‘DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’.
An unhandled exception of type ‘System.IO.FileLoadException’ occurred.
Additional information: Could not load file or assembly ‘DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.
- Revert back to DocumentFormat.OpenXml version 1.0.0
Install-Package DocumentFormat.OpenXml -Version 1.0.0
- Remove the assemblyBinding from the app.config
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <!-- Remove dependentAssembly for DocumentFormant.OpenXml --> <dependentAssembly> <assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.5.5631.0" newVersion="2.5.5631.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
Thank you so much this worked like a charm. I figured out that I needed to revert the version of the OpenXML and I did that but I was really banging my head against the wall trying to figure out that second manifest error message. Thanks again.
That’s why I blog this. Happy coding!
thanks Eric that worked for me as well, saved my time.
Thanks!!! You saved my life.
Thank you Eric! Works great.
Thank you, now I can continue with my job.
Got it to work with your help thanks!
Thank you! Thank you! Thank you! Saved quite a lot of frustration. 🙂
Hey Thanks a lot Eric! you saved my day!
thanks eric so much!
You saved the day, sir. Thank you!
Thank you, you saved my work