PRB: PEVerify.exe causes problem verifying add-in with referenced assemblies from Visual Studio not in the GAC

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005
Date: June 2009   Microsoft Visual Studio 2008
Updated: March 2013   Microsoft Visual Studio 2010
      Microsoft Visual Studio 2012


When using the peverify.exe tool of the .NET Framework to verify an add-in that references a Visual Studio assembly not in the Global Assembly Cache (GAC) but in the installation folder of Visual Studio (such as Microsoft.VisualStudio.Data.Interop.dll), you get this error:

Error 0x80070002 "The system cannot find the file specified"

Notice that the referenced assembly should have the Copy Local property set to False because assemblies in the installation folder of Visual Studio should not be redistributed. The referenced assembly will be located correctly when the add-in is hosted in Visual Studio. It won't be found when verifying it with the peverify.exe tool, though.

More Information

To solve this problem:

  • If your add-in dll is named "myaddin.dll", create a text file with the name "myaddin.dll.config"
  • Place this content inside that config file that specifies the file path of the referenced assembly (adjust the items in bold face):
Language: XML   Copy Code Copy Code (IE only)
<?xml version="1.0" ?>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="Microsoft.VisualStudio.Data.Interop" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <codeBase version="" 
               href="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Microsoft.VisualStudio.Data.Interop.dll" />

Once that file is placed in the same folder than the add-in dll, the peverify.exe tool will work fine.

Related articles

Go to the 'Visual Studio Extensibility (VSX)' web site for more articles like this (Articles section)