Udostępnij za pośrednictwem


How to: Create an Add-In

An add-in is a compiled DLL that runs in the Visual Studio integrated development environment (IDE). Compilation protects your intellectual property and improves performance. Although you can create add-ins manually, you may find it easier to use the Add-In Wizard. This wizard creates a functional but basic add-in that you can run immediately after you create it. After the Add-In Wizard generates the basic bare program, you can add code to it and customize it.

Important

You cannot create add-ins or wizards with a Visual Studio Express edition.

The Add-In Wizard lets you supply a display name and description for your add-in. Both of them will appear in Add-In Manager. Optionally, you can have the wizard generate code that adds to the Tools menu a command to open the add-in. You can also choose to display a custom About dialog box for your add-in. When the wizard is completed, you have a new project that has just one class, which is named Connect, that implements the add-in.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

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

  1. Create a Visual Studio add-in project. On the File menu, point to New and then click Project. Navigate to Extensibility in the Other Project Types node. When you create the project, the Add-In Wizard starts.

  2. On the Select a Programming Language page, select the programming language you want to use to write the add-in.

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

    This lets you choose the applications in which you want to be able to run the add-in after it is created; for example, Visual Studio or the Visual Studio Macros IDE.

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

    Note

    Because a period character (".") has a special meaning in Visual Studio commands, Visual Studio will not create a default Tools menu command if your add-in name contains a period. 

    After the add-in is created, its name and description are displayed in the Available Add-Ins list in Add-In Manager. Add enough detail to the description of your add-in so that users can learn what your add-in does, how it works, and so on.

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

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

    • When you want your add-in to start.

    • Whether your add-in uses a modal user interface (UI) or not. If it does not, it can be safely used with command-line builds.

  6. On the Choosing 'Help About' Information page, specify whether you want information about your add-in to be displayed in the Visual Studio About dialog box. If you do, add the information that you want to be displayed.

    Information that can be added to the Visual Studio About dialog box includes version number, support details, licensing data, and the like.

  7. After you complete steps 1-6, the options you selected are displayed on the Summary page for you to review. If you are satisfied, click Finish to create the add-in. If you want to change something, click the Back button.

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

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

Security

Managed add-ins are registered as .addin files, which are written in XML. The Add-In Wizard in Visual Studio .NET 2002 and Visual Studio .NET 2003 has a check box that lets you register your add-in for all users. The Add-In Wizard in Visual Studio 2005 and later do not have that check box. To register a managed add-in for all users in Visual Studio 2005 and later, copy the .addin file to the ..\Documents and Settings\All Users\ folder. To register an unmanaged add-in for all users in Visual Studio 2005 and later, change HKEY_CURRENT_USER to HKEY_CLASSES_ROOT in the relevant registry entries in the .reg file, and then apply the .reg file to the registry. For more information, see Best Practices for Security in Automation and Add-In Security. The Add-In Wizard and the automation assemblies are unavailable in the Express Editions of Visual Studio.

Note

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

You do not have to use add-ins, wizards, or macros to access automation functionality. Instead, you can add references to desired automation assemblies to any Visual Studio project, and then gain access to their types and members. However, by using automation in a macro or add-in, you can expose in the IDE any add-in tools that you create.

See Also

Tasks

How to: Control Add-Ins By Using the Add-In Manager

How to: Create Solution Add-Ins

Walkthrough: Creating a Wizard

Concepts

Add-In Registration

Automation Object Model Chart

Visual Studio Add-Ins vs. Shared Add-Ins

Other Resources

Creating Add-ins and Wizards