Export (0) Print
Expand All

How to: Add References to the EnvDTE and EnvDTE80 Namespaces 

When you add a reference to EnvDTE or EnvDTE80, you have the choice of using a .NET assembly or a COM library version. The one you should choose depends upon your project. If you are maintaining an older automation application or add-in, you might need to use the COM version of EnvDTE or EnvDTE80. If you are creating a new managed automation application or add-in, though, you will most likely want to use the .NET assembly version.

When you use the Add-in Wizard to create an add-in in any programming language or when you create a macro, the process creates references to the EnvDTE and EnvDTE80 namespaces. To access the automation objects outside of macros or add-ins created with the Add-in Wizard, however, you must manually add the references.

After you have references to the namespaces, you will most likely want to program against the DTE and DTE2 objects. For more information, see How to: Get References to the DTE and DTE2 Objects.

NoteNote

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

To manually add references to the EnvDTE and EnvDTE80 namespaces in Visual Basic or Visual C#

  1. In Solution Explorer, right-click either the project or the References node and click Add Reference, or click the Add Reference command on the Project menu.

  2. In the Add Reference dialog box, click the tab of the type of component you want, such as .NET or COM.

  3. Scroll down the list, select EnvDTE and EnvDTE80.

  4. Click OK to add the two new references to the project.

  5. To enable Intellisense for the new assemblies in the code editor, at the top of your project's module or class, add one of the following:

    Imports EnvDTE
    Imports EnvDTE80
    

    using EnvDTE;
    using EnvDTE80;
    

To manually add references to the EnvDTE and EnvDTE80 namespaces in Managed Visual C++

  1. In Solution Explorer, right-click the project node and click Add References, or click the Add References command on the Project menu.

  2. Click Add New Reference and then click the .NET tab.

  3. Scroll down the list, select EnvDTE and then click Add.

  4. Click Add New Reference.

  5. Scroll down the list, select EnvDTE80 and then click Add.

  6. Click OK to add the two new references to the project.

  7. To enable Intellisense for the new assemblies in the code editor, at the top of your main project file, add the following:

    // Visual C++
    #using <envdte.dll>
    #using <envdte80.dll>
    

To add references to EnvDTE and EnvDTE80 namespaces to Non-Managed (ATL) Visual C++

  • In an appropriate header or source file, add the following:

    #pragma warning( disable : 4278 )
    #pragma warning( disable : 4146 )
    //The following #import imports EnvDTE based on its LIBID.
    #import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") 
    lcid("0") raw_interfaces_only named_guids
    //The following #import imports EnvDTE80 based on its LIBID.
    #import "libid:1A31287A-4D7D-413e-8E32-3B374931BD89" version("8.0") 
    lcid("0") raw_interfaces_only named_guids
    #pragma warning( default : 4146 )
    #pragma warning( default : 4278 )
    

See Also

Community Additions

ADD
Show:
© 2014 Microsoft