Share via


Creating an Add-In

The Add-In Wizard creates an Add-in with a fully functional framework that you can run immediately after you finish creating it. After the Add-In Wizard generates the basic framework, you can add code to it and customize it.

Note   Add-ins created in Visual Studio .NET 2003 will not work correctly in Visual Studio .NET 2002.

As an alternative to creating an Add-in, you can create a macro to access the Visual Studio automation model. For more information on this, see The Spectrum of Visual Studio .NET Automation and Automating Repetitive Actions by Using Macros.

The Add-in Wizard

The Add-In Wizard lets you supply a display name and description for the Add-in, both of which appear in the Add-In Manager dialog box. Optionally, you can choose to have the Wizard generate code that adds a command to the Tools menu to load and invoke the Add-in. When the Wizard completes, you have a new project with a single module that implements the add-in. You also have a setup project that builds an .msi file that can be used to install the Add-in on another system (or to update the Add-in's registration on the development machine as is sometimes necessary depending on what you do with your Add-in).

To create an Add-in using the Add-In Wizard

  1. Create a new Visual Studio Add-In project.

    You can find this project type in the Extensibility Projects folder under Other Projects.

  2. Select one of the languages from the Select a Programming Language panel.

    This allows you to select a language in which the Add-in will be generated.

  3. Choose one or more applications, such as Visual Studio .NET, from the Select an Application Host panel.

    This allows you to select the applications in which you want to be able to run the Add-in after its creation.

  4. Enter the name and description for your Add-in in the Enter a Name and Description panel.

    This name displays in the Add-In Manager dialog's Available Add-Ins list and informs users what the Add-in does, how it works, and so forth.

  5. In the Choose Add-in Options panel, specify whether you want the Add-in to appear in the Tools menu, when you want the Add-in to start, and whether the Add-in will be available to others or not.

    This allows you to specify certain behavior options for your Add-in.

  6. In the Choosing Help About Information panel, specify whether you want a Help About box, and if you do, specify the information you want it to display.

    This allows you to create a Help About window for your Add-in that displays version information, support information, licensing information, and so forth.

    After following steps 1-6, the options you selected are displayed in a summary page.

  7. Choose Finish to create the Add-in.

You now have a fully functional, empty Add-in. To enable the Add-in to do something useful, you must add the appropriate code.

To learn about what the Add-In Wizard does behind the scenes, examine the deployment project it creates.

Add-in Commands Issue

When you create an Add-in using the Add-in Wizard and then run it, another instance of Visual Studio .NET starts, allowing you to test and debug the resultant Add-in. One or more commands for the Add-in are placed on one or more menus, such as the Tools menu. When you finish debugging the Add-in and then close this second instance of Visual Studio .NET, the command information is saved.

When you eventually close the first instance of Visual Studio .NET, however, the command information that was written by the second instance of Visual Studio .NET is overwritten. The effect is that when you restart Visual Studio .NET, your new Add-in command no longer appears on the menu. There is a procedure you can follow to restore the commands to the menu.

To restore Add-in commands to the menu

  1. Build the setup project created by the wizard.
  2. Shut down all instances of Visual Studio .NET.
  3. Execute the .msi file from the setup project.
  4. Re-start Visual Studio .NET.

From now on, when you run Visual Studio .NET, the Add-in's commands will be present on the menus. The setup project will build and install faster if you modify it to exclude the .NET Runtime redistributable merge module.

See Also

Add-In Registration | Automation Object Model Chart | Controlling Add-Ins with the Add-In Manager | Creating Add-Ins and Wizards | Creating a Wizard | IDTExtensibility2 Interface