Export (0) Print
Expand All

How to: Create an Add-in 

An add-in is a compiled DLL that runs inside the Visual Studio integrated development environment (IDE). The fact that it is compiled protects your intellectual property and improves performance. While you can create add-ins manually, it is far easier to use the Add-In Wizard. The Add-In Wizard creates an add-in with a fully functional but basic framework that you can run immediately after you create it. After the Add-In Wizard generates the basic framework, you can add code to it and customize it.

To learn more about See

The differences between Visual Studio add-ins and shared add-ins.

Visual Studio Add-ins Versus Shared Add-ins

Solution-based add-ins.

How to: Create Solution Add-ins

Visual Studio Add In Wizard
NoteNote

The Add-In Wizard and the automation assemblies are not available in the Express Editions of Visual Studio.

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. You can also choose to display a custom About Box for your add-in. When the wizard completes, you have a new project with a single class named Connect that implements the add-in.

NoteNote

Add-Ins created in Visual Studio 2005 do not work in Visual Studio .NET 2003. Add-ins created in Visual Studio .NET 2003 may not work correctly in Visual Studio 2005 without first migrating them. For more information, see Migrating and Upgrading Add-ins from Visual Studio .NET 2003 to Visual Studio 2005.

To access automation without creating an add-in, a convenient alternative is to use a macro. Macros provide quick and easy access to the various automation models in Visual Studio. For more information, see The Spectrum of Visual Studio Automation and Automating Repetitive Actions by Using Macros.

Of course, you do not need to use add-ins, wizards, or even macros to access automation functionality. If you simply add the desired assembly references to any Visual Studio project, then you gain access to their types and members. However, using automation within a macro or add-in allows you to easily expose any add-in tools you create inside the Visual Studio IDE.

This example demonstrates how to create a solution add-in.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

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

  1. Create a new Visual Studio Add-In project. This starts the Add-In Wizard.

    This project type is in the Extensibility folder under Other Project Types.

  2. Select a language on the Select a Programming Language page.

    This allows you to select a programming language in which the add-in will be written.

  3. Choose one or more applications, such as Visual Studio, on the Select an Application Host page.

    This allows you to select the applications in which you want to be able to run the add-in after the add-in is created, such as Visual Studio or the Visual Studio Macros IDE.

  4. Type the name and description for your add-in on the Enter a Name and Description page.

    After the add-in is created, the name and description display in the Add-In Manager dialog box's Available Add-Ins list and inform users what the add-in does, how it works, and so forth.

  5. On the Choose Add-In Options page, you can specify:

    • Whether you want your add-in to appear in the Tools menu.

    • When you want your add-in to start.

    • Whether your add-in does not use a modal user interface (UI) and can thus be safely used with command-line builds.

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

  6. On the Choosing 'Help About' Information page, specify whether you want to display information about your add-in in the Visual Studio Help About window, and if so, the information you want to display.

    Information that can be added to the Visual Studio Help About window includes version number, support details, licensing data, and so forth.

    After completing steps 1-6, the selected options are displayed on the Summary page.

  7. Choose Finish to create the add-in.

    You now have a fully functional, basic add-in. To enable the add-in to do something useful, you must add the appropriate code. For more information, see Extending the Visual Studio Environment.

    To learn about what the Add-In Wizard does behind the scenes, you can examine the code it creates.

Security

Managed add-ins are registered using a .Addin XML file. The Add-In Wizard in Visual Studio .NET 2002 and Visual Studio .NET 2003 has a checkbox that allows you to register the add-in for all users. The Add-In Wizard in Visual Studio 2005 does not have that checkbox. To register a managed Add-In for all users in Visual Studio 2005, copy the .Addin XML file to the [Drive letter]:\Documents and Settings\All Users directory. To register an unmanaged add-in for all users in Visual Studio 2005, edit the .reg file, change HKCU to HKCR in the registry, and apply the .reg file to the registry. For more information, see Best Practices for Security in Automation and Add-In Security.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft