Freigeben über


Gewusst wie: Erstellen von Add-Ins

Aktualisiert: November 2007

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.

To learn more about

See

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

Visual Studio-Add-Ins und gemeinsame Add-Ins

Solution-based add-ins.

Gewusst wie: Erstellen von Projektmappen-Add-Ins

Hinweis:

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

The Add-In Wizard lets you supply a display name and description for your add-in. Both of them will appear in the Add-In Manager dialog box. Optionally, you can choose to 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 Box for your add-in. When the wizard is completed, you have a new project with a single class, which is named Connect, that implements the add-in.

Hinweis:

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 unless they are migrated. For more information, see Migrieren und Aktualisieren von Add-Ins von Visual Studio 2005 auf Visual Studio 2008.

To access automation without creating an add-in, you can use a macro. Macros provide quick and easy access to the various automation models in Visual Studio. For more information, see Das Automatisierungsspektrum von Visual Studio and Automatisieren von wiederkehrenden Aktionen mit Makros.

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.

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

Hinweis:

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-Einstellungen.

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

  1. Create a new 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. Choose 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 StudioMacros IDE.

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

    Hinweis:

    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 the Add-In Manager dialog box. 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 StudioHelp About window. If you do, add the information that you want to be displayed.

    Information that can be added to the Visual StudioHelp About window 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 Erweitern der Visual Studio-Umgebung.

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

Sicherheit

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, 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, 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 Empfohlene Vorgehensweisen für die Sicherheit bei der Automatisierung and Add-In-Sicherheit.

Siehe auch

Aufgaben

Gewusst wie: Steuern von Add-Ins mit dem Add-In-Manager

Exemplarische Vorgehensweise: Erstellen eines Assistenten

Konzepte

Add-In-Registrierung

Diagramm "Automationsobjektmodell"

Weitere Ressourcen

Erstellen von Add-Ins und Assistenten