Microsoft KB Archive/823236

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

Article ID: 823236

Article Last Modified on 2/24/2006

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * 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:

However, these registry entries should be added to the  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  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:  Follow steps 1 through 4 in the &quot;More Information&quot; section of this article to create a new add-in. Click Start, and then click Run. In the Open text box, type regedit, and then press ENTER. In Registry Editor, locate the following registry key:

 Expand AddIns. Right-click InsertText.Connect, and then click Export.</li> In the Export Registry File dialog box, type regfile in the File name text box.</li> Click Desktop in the Save in list, and then click Save.</li> In a text editor such as Notepad, open Regfile.reg (located on the desktop).</li> In Regfile.reg, replace each occurrence of 7.0 with 7.1 in the registry key. Save the changes, and then close the file.</li> Drag Regfile.reg to Registry Editor.</li> When you receive the following message, click OK:

Information in <%regfile.reg%> has been successfully entered into the registry on My Computer.

</li> Follow step 5 in the &quot;More Information&quot; section to install the add-in.</li> Start Visual Studio .NET 2003.

Notice that the InsertText command appears on the Tools menu.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
<ol> Start Visual Studio .NET 2002.

Note You must have Visual Studio .NET 2002 and Visual Studio .NET 2003 installed on your computer.</li> Create a new add-in. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> Under Project Types, expand Other Projects, and then click Extensibility Projects.</li> Under Templates, click Visual Studio .NET Add-in.</li> In the Name text box, type InsertText .</li> Click OK.</li> On the Welcome to the Add-in Wizard page, click Next.</li> 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.</li> <li>On the Select An Application Host page, click to clear the check box for Microsoft VSMacros IDE, and then click Next.</li> <li>On the Enter a Name and Description page, type InsertText for the name.</li> <li>Click Next.</li> <li>On the Choose Add-in Options. page, click to select the following two check boxes, and then click Next: <ul> <li>'''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-</li> <li>I would like my Add-in to load when the host application starts.</li></ul> </li> <li>On the Choosing 'Help About' Information page, click Next.</li> <li>On the Summary page, click Finish.</li></ol> </li> <li> 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 &quot;Hello World&quot; in the file. If Not IsNothing(applicationObject.ActiveDocument) Then CType(applicationObject.ActiveDocument.Selection, TextSelection).Text = &quot;Hello World&quot; End If   Return True End Function Visual C# .NET Code public bool InsertText //This inserts the text &quot;Hello World&quot; in the file. {   if (applicationObject.ActiveDocument !=null) ((TextSelection)applicationObject.ActiveDocument.Selection).Text=&quot;Hello World&quot;; return true; } </li> <li> 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; </li> <li>Build and then install the add-in. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>On the Build menu of Visual Studio .NET 2002, click Build Solution.</li> <li>In Solution Explorer, right-click InsertTextSetup, and then click Build.</li> <li>Right-click InsertTextSetup, and then click Install.</li> <li>On the Welcome to the InsertTextSetup Setup Wizard page, click Next.</li> <li>On the Select Installation Folder page, type the folder location in the Folder text box.</li> <li>Click Next.</li> <li>On the Confirm Installation page, click Next, and then click Close.</li></ol> </li> <li>Quit Visual Studio .NET.</li> <li>Start Visual Studio .NET 2002.

Notice that the InsertText command appears on the Tools menu.</li> <li>Start Visual Studio .NET 2003.

Notice that the InsertText command does not appear on the Tools menu.</li></ol>

<div class="references_section">