Search code examples
c#.netvstoopenxmlopenxml-sdk

Type or namespace 'DocumentFormat' could not be found - only on build - but intellisense shows the type as available


I have downloaded the Power Tools for Open XML from the following website:-

https://powertools.codeplex.com/

I open the solution in VS2012 and then update the references - DocumentFormat.OpenXml and WindowsBase.

The problem is:-

The Visual Studio intellisense shows the namespace when I start typing it at the top of class, but when I build the solution, I get the following error from all the classes where this namespace is used-

The type or namespace 'DocumentFormat' could not be found.


Solution

  • Depending on your requirements and environment, you need to match the PowerTools and OpenXML SDK versions.

    PowerTools 2.2 (which right now is the default download on codeplex) uses DocumentFormat.OpenXml version 2.0.5022.0 which comes with OpenXml SDK 2.0.
    This project is built on .NET Framework 3.5.

    PowerTools for OpenXML 3.0 version 3.* (also available to download at https://powertools.codeplex.com/releases/view/74771) uses DocumentFormat.OpenXml version 2.5.5631.0 which comes with OpenXml SDK 2.5.
    This project is built on .NET Framework 4.0+.