HOWTO: Debug add-ins for the macros IDE.

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio .NET 2002
Date: April 2009   Microsoft Visual Studio .NET 2003
Updated: March 2013   Microsoft Visual Studio 2005
      Microsoft Visual Studio 2008
      Microsoft Visual Studio 2010

Add-ins can be created for the Visual Studio IDE, but also for the macros IDE ("Tools", "Macros", "Macros IDE"). The process of the Visual Studio IDE is devenv.exe, while the process for the macros IDE is vsaenv.exe.

To debug an add-in for the Visual Studio IDE you can set the devenv.exe executable as the external process to launch on debug. However, the vsaenv.exe executable can't be launched independently and a different approach is needed to debug add-ins loaded in this Macros IDE.

More Information

To debug an add-in for the macros IDE follow these steps:

  • Build the add-in project in "Debug" configuration.
  • Ensure that the build output folder and file are the ones used when registering the add-in. Note: registration of add-ins for the macros IDE is not explained here (the add-in project wizard gives the option to register the add-in for the macros IDE).
  • Ensure that the add-in is not marked to load at startup (at least during the debugging sessions).
  • Set a breakpoint in the OnConnection method of the add-in.
  • In the Debug property page of the add-in project, set the "Start action" setting  to "Start project" (not to "Start external program).
  • Launch by hand a second IDE instance.
  • Open its macros IDE ("Tools", "Macros", "Macros IDE"). At this point the vsaenv.exe process is created.
  • In the first Visual Studio IDE with the add-in project, select the "Tools", "Attach to Process..." menu.
  • Select the vsaenv.exe process in the "Available Processes" list and click the "Attach" button. At this point the add-in project should enter in debug mode.
  • In the Macros IDE of the second Visual Studio instance, go to the "Tools", "Add-In Manager" menu and load your add-in. At this point the breakpoint in the OnConnection method of the add-in project should be hit and you can debug your add-in for the macros IDE.

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