Verweisen auf Automatisierungsassemblys und das DTE2-Objekt
Aktualisiert: November 2007
To create automation applications, you must perform steps to gain access to the automation members. First, you must reference the requisite automation assemblies, and second, you must get a reference to the top-level object, DTE2.
In Visual Studio .NET 2002 and Visual Studio .NET 2003, all core automation items were located in an assembly named EnvDTE, and its highest, hierarchical object is the DTE object. It is the parent object for all core automation objects, collections, and their members. DTE2 derives from DTE.
In Visual Studio 2005 and Visual Studio 2008, additions and updates were made to some of these objects, collections, and members. Rather than update the existing assembly and compromise backwards-compatibility for existing add-ins and automation projects, all new, updated functionality is in an assembly named EnvDTE80 (EnvDTE version 8.0) and EnvDTE90 (EnvDTE version 9.0). Most updated functions in EnvDTE80 and EnvDTE90 maintain the same names as previous versions but append a number to the end of the function name. For example, the newer version of the TaskItems collection is named TaskItems2, and the newer version of the Solution object is named Solution2. Because the new members are more robust than previous versions and contain the latest functionality, the recommended approach is to use the new objects and collections when writing new automation applications.
Although new items are in EnvDTE80 and EnvDTE90, most of the core automation functionality is still in EnvDTE. So, when you write new automation applications (such as add-ins), be sure to reference EnvDTE, EnvDTE80, and EnvDTE90. You can do this in one step by referencing the COM libraries "Microsoft Development Environment 8.0" and "Microsoft Development Environment 9.0." Also, if you use members from the EnvDTE assembly, you must also set a reference to both the DTE object and the DTE2 object. This gives you access to all of the items.
For information about gaining access to the project-specific object models, see Funktionelle Automatisierungsgruppen.
In diesem Abschnitt
Gewusst wie: Hinzufügen von Verweisen auf die Namespaces EnvDTE, EnvDTE80 und EnvDTE90
Demonstrates how to add references to the appropriate namespaces.Fehler beim Verwenden von EnvDTE mit VSLangProj-Assemblys
Outlines a possible error you can receive when a project uses the EnvDTE assembly and one or more of the VSLangProj assemblies.Gewusst wie: Abrufen von Verweisen auf das DTE-Objekt und das DTE2-Objekt
Demonstrates how to get references to the appropriate objects.Anfügen an bestimmte Instanzen der IDE
Provides information about how to reference a particular instance of the integrated development environment (IDE).
Verwandte Abschnitte
Diagramm "Automationsobjektmodell"
Provides a graphical roadmap to all shared components of the Automation Object Model.Erstellen von Add-Ins und Assistenten
Provides basic information about creating Add-ins and Wizards in Visual Studio.