Add-ins that you create by using Visual Studio .NET 2002 do not load when you start Visual Studio .NET 2003 (823236)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

You create an add-in project in Visual Studio .NET 2002. When you install the add-in project on a computer that has Visual Studio .NET 2003 installed, the add-in is not loaded in the Visual Studio .NET 2003 IDE.

CAUSE

This problem occurs because the registry entries for the add-in are not created in the correct registry key.

When you install the add-in project on a computer that has Visual Studio .NET 2003 installed, the registry entries are created in the following registry key:

HKEY_CURRENT_USER\Microsoft\VisualStudio\7.0\Addins

However, these registry entries should be added to the \7.1 registry key of Visual Studio .NET. Therefore, the add-in is not loaded when you start Visual Studio .NET 2003.

Note When you select the My Add-in should be available to all users of the computer it was installed on, not just the person who installs it. option on the Choose Add-in Options page of the Add-in Wizard, the registry entries are created in the HKEY_LOCAL_MACHINE\Microsoft\VisualStudio\7.0\Addins registry key.

WORKAROUND

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk. To work around this problem, create a registry key to load the add-in when you start Visual Studio .NET 2003. To do this, follow these steps:
  1. Follow steps 1 through 4 in the "More Information" section of this article to create a new add-in.
  2. Click Start, and then click Run.
  3. In the Open text box, type regedit, and then press ENTER.
  4. In Registry Editor, locate the following registry key:

    HKEY_CURRENT_USER\Software\Microsoft \VisualStudio\7.0\AddIns

  5. Expand AddIns.
  6. Right-click InsertText.Connect, and then click Export.
  7. In the Export Registry File dialog box, type regfile in the File name text box.
  8. Click Desktop in the Save in list, and then click Save.
  9. In a text editor such as Notepad, open Regfile.reg (located on the desktop).
  10. In Regfile.reg, replace each occurrence of 7.0 with 7.1 in the registry key. Save the changes, and then close the file.
  11. Drag Regfile.reg to Registry Editor.
  12. When you receive the following message, click OK: Information in <%regfile.reg%> has been successfully entered into the registry on My Computer.
  13. Follow step 5 in the "More Information" section to install the add-in.
  14. Start Visual Studio .NET 2003.

    Notice that the InsertText command appears on the Tools menu.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Visual Studio .NET 2002.

    Note You must have Visual Studio .NET 2002 and Visual Studio .NET 2003 installed on your computer.
  2. Create a new add-in. To do this, follow these steps:
    1. Under Project Types, expand Other Projects, and then click Extensibility Projects.
    2. Under Templates, click Visual Studio .NET Add-in.
    3. In the Name text box, type InsertText.
    4. Click OK.
    5. On the Welcome to the Add-in Wizard page, click Next.
    6. On the Select a Programming Language page, click Create an Add-in using Visual Basic. or Create an Add-in using Visual C#., and then click Next.
    7. On the Select An Application Host page, click to clear the check box for Microsoft VSMacros IDE, and then click Next.
    8. On the Enter a Name and Description page, type InsertText for the name.
    9. Click Next.
    10. On the Choose Add-in Options. page, click to select the following two check boxes, and then click Next:
      • Yes, create a 'Tools' menu item. By default this will cause the Add-in to load when the button is clicked unless the Add-in is set to load on startup of the host application.

        -and-
      • I would like my Add-in to load when the host application starts.
    11. On the Choosing 'Help About' Information page, click Next.
    12. On the Summary page, click Finish.
  3. In the Connect class, add the following sample code after the Exec procedure:

    Visual Basic .NET Sample Code
    Public Function InsertText() As Boolean
        'This inserts the text "Hello World" in the file.
        If Not IsNothing(applicationObject.ActiveDocument) Then
             CType(applicationObject.ActiveDocument.Selection, TextSelection).Text = "Hello World"
        End If
        Return True
    End Function
    Visual C# .NET Code
    public bool InsertText()
    //This inserts the text "Hello World" in the file.
    {
        if (applicationObject.ActiveDocument !=null) 
             ((TextSelection)applicationObject.ActiveDocument.Selection).Text="Hello World";
        return true;
    }
  4. In the Exec procedure, change the following code:

    Existing Visual Basic .NET Code
     handled = True
    Existing Visual C# .NET Code
    handled = true;
    Change to:
    Visual Basic .NET Sample Code
    handled = InsertText()
    Visual C# .NET Sample Code
    handled = InsertText();
  5. Build and then install the add-in. To do this, follow these steps:
    1. On the Build menu of Visual Studio .NET 2002, click Build Solution.
    2. In Solution Explorer, right-click InsertTextSetup, and then click Build.
    3. Right-click InsertTextSetup, and then click Install.
    4. On the Welcome to the InsertTextSetup Setup Wizard page, click Next.
    5. On the Select Installation Folder page, type the folder location in the Folder text box.
    6. Click Next.
    7. On the Confirm Installation page, click Next, and then click Close.
  6. Quit Visual Studio .NET.
  7. Start Visual Studio .NET 2002.

    Notice that the InsertText command appears on the Tools menu.
  8. Start Visual Studio .NET 2003.

    Notice that the InsertText command does not appear on the Tools menu.

REFERENCES

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

317345 HOW TO: Create and Load Add-ins in the Visual Studio .NET IDE by Using Visual Basic .NET


Modification Type:MinorLast Reviewed:2/24/2006
Keywords:kbvs2005doesnotapply kbvs2005swept kbRegistry kbide kbAddIn kbprb KB823236 kbAudDeveloper