This documentation is archived and is not being maintained.

Referencing Automation Assemblies and the DTE2 Object 

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.

For Visual Studio 2005, 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). Most updated functions in EnvDTE80 maintain the same names as previous versions but append the numeral 2 to the function name. For example, the new version of the TaskItems collection is named TaskItems2, and the new 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. For a complete list of the new objects and collections, see New Automation Members for Visual Studio 2005.

Although new items are in EnvDTE80, 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 both EnvDTE and EnvDTE80. You can do this in one step by referencing the COM library "Microsoft Development Environment 8.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 Functional Automation Groups.

In This Section

How to: Add References to the EnvDTE and EnvDTE80 Namespaces

Demonstrates how to add references to the appropriate namespaces.

Error Using EnvDTE with VSLangProj Assemblies

Outlines a possible error you can receive when a project uses the EnvDTE assembly and one or more of the VSLangProj assemblies.

How to: Get References to the DTE and DTE2 Objects

Demonstrates how to get references to the appropriate objects.

Attaching to Specific Instances of the IDE

Provides information about how to reference a particular instance of the integrated development environment (IDE).

Related Sections

Automation Object Model Chart

Provides a graphical roadmap to all shared components of the Automation Object Model.

Creating Add-ins and Wizards

Provides basic information about creating Add-ins and Wizards in Visual Studio.