PRB: PEVerify.exe causes problem with EnvDTE.dll verifying Visual Studio 2005 add-ins

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005
Date: September 2007   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 2.0 SDK or higher to verify Visual Studio 2005 (or higher) add-ins, you can get errors like these:

  • [found ref 'EnvDTE.ProjectItem'][expected ref 'EnvDTE.ProjectItem'] Unexpected type on the stack.
  • [found ref 'EnvDTE.Project'][expected ref 'EnvDTE.Project'] Unexpected type on the stack.
  • Unable to resolve token.
  • Etc.

More Information

This problem happens if your add-in uses the VSLangProj.dll, because that assembly references EnvDTE.dll version 7.0.3300.0 while Visual Studio 2005 (or higher) add-ins reference EnvDTE.dll version

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 (no changes to the content are required):
Language: XML   Copy Code Copy Code (IE only)
<?xml version="1.0" ?>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="EnvDTE" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="7.0.3300.0" newVersion="" />

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

Note: Visual Studio 2005 or higher has a "devenv.exe.config" file in the installation folder ("C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" for Visual Studio 2005) that does the same for things to work fine in the IDE.

Related articles

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