I\'m keep getting this error is VS2013
Could not load file or assembly \'DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neut
ral, PublicKeyToken=31b
Had the same problem recently.
I have ClosedXML referenced in a library and when I use the library in a console application I get missing reference error.
This is because the DocumentFormat.Excel, ExcelNumberFormat and FastMember.Signed are not copied into the output folder of my console application.
2 solutions :
1) install the closedXML nuget package and all its dependencies in the client (console application project in this case).
2) To have the dll copied you have to reference them in the library. Add the following function to the library and call it from the static constructor:
///
/// This code is here to embeed the following libraries :
/// - DocumentFormat.Excel
/// - ExcelNumberFormat
/// - FastMember.Signed
///
private static void EmbeedNeededLibraries()
{
Action noop = _ => { };
var lib1 = typeof(DocumentFormat.OpenXml.OpenXmlAttribute);
var lib2 = typeof(ExcelNumberFormat.NumberFormat);
var lib3 = typeof(FastMember.ObjectAccessor);
noop(lib1);
noop(lib2);
noop(lib3);
}