Gewusst wie: Hinzufügen von Verweisen auf die Namespaces EnvDTE, EnvDTE80 und EnvDTE90
Aktualisiert: November 2007
When you add a reference to EnvDTE, EnvDTE80, or EnvDTE90, 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, EnvDTE80, or EnvDTE90. 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, EnvDTE80, or EnvDTE90 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 Gewusst wie: Abrufen von Verweisen auf das DTE-Objekt und das DTE2-Objekt.
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 ExportSettings on the Tools menu. For more information, see Visual Studio-Einstellungen. |
To manually add references to the EnvDTE and EnvDTE80 namespaces in Visual Basic or Visual C#
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.
In the Add Reference dialog box, click the tab of the type of component you want, such as .NET or COM.
Scroll down the list, select EnvDTE, EnvDTE80, and EnvDTE90.
Click OK to add the two new references to the project.
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 Imports EnvDTE90
using EnvDTE; using EnvDTE80; using EnvDTE90;
To manually add references to the EnvDTE and EnvDTE80 namespaces in Managed Visual C++
In Solution Explorer, right-click the project node and click Add References, or click the Add References command on the Project menu.
Click Add New Reference and then click the .NET tab.
Scroll down the list, select EnvDTE, EnvDTE80, and EnvDTE90 and then click Add.
Click OK to add the new references to the project.
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> #using <envdte90.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 )
Siehe auch
Aufgaben
Gewusst wie: Steuern von Add-Ins mit dem Add-In-Manager
Exemplarische Vorgehensweise: Erstellen eines Assistenten
Konzepte
Diagramm "Automationsobjektmodell"