Logo
BUG: Add-ins not loaded from the command line in Visual Studio 2005 SP1

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio 2005 SP1
Date: February 2007    
       
Introduction

When you set a Visual Studio 2005 SP1 add-in to load when the IDE is started from the command line (for a build), the add-in is not loaded.

Cause

This is a bug of Visual Studio 2005 SP1.

More Information

Steps to reproduce the problem:

  • Create a VS 2005 SP1 add-in with name "MyCommandLineAddin" using the wizard:
  • In the page 4 of 6, mark the checkbox to execute the add-in from the command-line.
  • Add this code for the add-in (when loaded, the add-in shows a message with the connection mode):
    Imports System
    Imports Extensibility
    Imports EnvDTE
    
    Public Class Connect
       Implements IDTExtensibility2
    
       Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, _
          ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    
          System.Windows.Forms.MessageBox(connectMode.ToString())
    
       End Sub
    
       Public Sub OnDisconnection(ByVal disconnectMode As ext_DisconnectMode, ByRef custom As Array) _
          Implements IDTExtensibility2.OnDisconnection
       End Sub
    
       Public Sub OnAddInsUpdate(ByRef custom As Array) Implements IDTExtensibility2.OnAddInsUpdate
       End Sub
    
       Public Sub OnStartupComplete(ByRef custom As Array) Implements IDTExtensibility2.OnStartupComplete
       End Sub
    
       Public Sub OnBeginShutdown(ByRef custom As Array) Implements IDTExtensibility2.OnBeginShutdown
       End Sub
    
    End Class
  • Build the add-in and close Visual Studio.
  • Go to Start, Programs, Microsoft Visual Studio 2005, Visual Studio Tools and execute Visual Studio 2005 Command Prompt.
  • In the DOS window that is opened, type the following command to compile a solution such as WindowsApplication1 from the command line:

    devenv.exe WindowsApplication1.sln /build Debug
  • The solution is compiled but the add-in was not loaded (it didn't show the message box).

Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this


Top