Referencing Automation Assemblies and the DTE2 Object
Visual Studio add-ins are deprecated in Visual Studio 2013. You should upgrade your add-ins to VSPackage extensions. For more information about upgrading, see FAQ: Converting Add-ins to VSPackage Extensions.
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 previous versions of Visual Studio, 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 subsequent versions of Visual Studio, 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 assemblies named EnvDTE80 (EnvDTE version 8.0), EnvDTE90 (EnvDTE version 9.0), and EnvDTE100 (EnvDTE version 10.0). Most updated functions in [N:EnvDTE80,]EnvDTE90, and EnvDTE100 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, EnvDTE90, and EnvDTE100, 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, EnvDTE90, and EnvDTE100. You can do this in one step by referencing the COM libraries "Microsoft Development Environment 8.0", "Microsoft Development Environment 9.0", "Microsoft Development Environment 9.0A", and "Microsoft Development Environment 10.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 Automation Namespaces
Demonstrates how to add references to the appropriate namespaces.
Error When EnvDTE Is Used 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).