I’m developing a C# application which uses the library ClosedXML in order to generate XLSX files, and I ran into this error: “Could not load file or assembly ‘DocumentFormat.OpenXml, Version=, Culture=neutral, PublicKeyToken=8fb06cb64d019a17’ or one of its dependencies. The system cannot find the file specified.
File name: ‘DocumentFormat.OpenXml, Version=, Culture=neutral, PublicKeyToken=8fb06cb64d019a17′”.

It’s weird, because in my development environment it works all ok, but running the program in the production machine I get the error above.

To be honest I couldn’t find an explanation, but here is a quick and dirty solution…

Go to Nuget site at this address:


And click on the link “Download package”.

You should have download a file named “documentformat.openxml.2.7.2.nupkg”. As many of you will know, a Nuget package is nothing else but a zip file with a different extension. So rename the file from “documentformat.openxml.2.7.2.nupkg” to “documentformat.openxml.2.7.2.zip” and extract the content with your favorite zip extractor.

In the subfolder “lib” take the file “DocumentFormat.OpenXml.dll” (choose the correct folder depending on the version of .NET you are using) and copy this file over the version you are using in your production machine.

Also remember that you may need to restart your application after copying the library. For example I was developing a Windows service, and I needed to stop and start the service to see it work.

Have a nice day!