Could not load file or assembly 'DocumentFormat.OpenXml Could not load file or assembly 'DocumentFormat.OpenXml xml xml

Could not load file or assembly 'DocumentFormat.OpenXml


I had this problem because I had a new version of the .dll installed on my computer running on localhost and my server was running an old version of the same .dll

I just updated it and everything works well after that.

In your case, install the DocumentFormat.OpenXml version 2.5 available in this microsoft link


At the time of writing this answer, there are 3 versions of Open XML SDK:

You most probably have referenced in your project DLL version 2.5 which was installed on your machine.
To get required v2.0 assembly, I suggest you to use NuGet I provided above.


You can look this example.

http://www.aspsnippets.com/Articles/Solution-ASPNet-GridView-Export-to-Excel-The-file-you-are-trying-to-open-is-in-a-different-format-than-specified-by-the-file-extension.aspx

I download the example and i imported the

  • ClosedXML.dll
  • DocumentFormat.OpenXml.dll

dlls (realted dlls is allready in project. And i used them). After that my error is gone. You can try.. I dont know why. But the importent is my project is working right now..