PowerTools 2.2 source code cannot be Referenced in another project

May 2, 2013 at 1:02 PM
I'm trying to use the PowerTools 2.2 in my project, I need to use the MarkupSimplifier class as in Eric's blog post - http://ericwhite.com/blog/2011/03/09/getting-started-with-open-xml-powertools-markup-simplifier.

I’m using it with Visual Studio 2010 in the source code. I’ve included the PowerTools 2.2 project that I downloaded from codeplex to my solution and then added the reference to OpenXmlPowerTools in my project so I can use MarkupSimplifier.
When I try to debug the solution initially it loads fine but later gives an exception:
System.IO.FileNotFoundException was caught
Message=Could not load file or assembly ‘OpenXmlPowerTools, Version=, Culture=neutral, PublicKeyToken=981466f262afc448′ or one of its dependencies. The system cannot find the file specified.
I’m really stumped, I’ve tried adding reference to only the OpenXmlPowerTools DLL but that doesn’t seem to work either and gives same message.
Also, I’m using Windows Server 2008 R2, and Sharepoint 2010 with Powershell 2.0

Not sure what might be causing the exceptions?
Please could someone help.

Many thanks
May 6, 2013 at 1:18 PM

I am not sure but adding references to "DocumentFormat.OpenXml" and "WindowsBase" apart from OpenXmlPowerTools dll in your project can resolve your issue.

-- Fenil.
Aug 2, 2013 at 12:31 PM

Another approach is to just drop the PowerTools source code modules directly in your C# project. This is what I do all the time. For MarkupSimplifier.cs, you need:
  • PtUtil.cs
  • PtOpenXmlUtil.cs
  • PtOpenXmlDocument.cs
  • MarkupSimplifier.cs
  • RevisionAccepter.cs
Then you will certainly have no problems with linking, or with finding the DLL in the GAC.

Cheers, Eric