BUG: ext_ConnectMode.ext_cm_CommandLine flag not passed to Visual Studio .NET 2002 add-ins.

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio .NET 2002
Date: June 2004   Microsoft Visual Studio 2005
Updated: March 2009    

When you load the Visual Studio .NET 2002/2005 IDEs from the command-line using devenv.exe to build a solution, addins marked as command-line add-ins do not receive the value ext_ConnectMode.ext_cm_CommandLine in the connectMode parameter of the OnConnection method.


This is a bug of Visual Studio .NET 2002. It was fixed in Visual Studio .NET 2003.

More Information

Steps to reproduce the problem:

  • Create a Visual Studio .NET 2002 addin with this code:
Public Sub OnConnection(ByVal application As Object, _
    ByVal connectMode As Extensibility.ext_ConnectMode, _
    ByVal addInInst As Object, ByRef custom As System.Array) _
    Implements Extensibility.IDTExtensibility2.OnConnection

   If connectMode = ext_ConnectMode.ext_cm_CommandLine Then

      MessageBox.Show("Launched from command line")


      MessageBox.Show("NOT Launched from command line")

   End If

End Sub
  • Run the add-in to register it, and in the Add-In Manager mark it to load on startup and from the command-line.
  • Close all IDE instances.
  • Open a Visual Studio .NET 2002 Command Prompt and use:
    devenv.exe MySolution.sln /build Debug
    to load the IDE and compile a solution without showing the user interface of Visual Studio .NET .
  • The add-in shows the message "NOT Launched from command line". In Visual Studio .NET 2003, it shows correctly the message "Launched from command line".

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