This topic has not yet been rated - Rate this topic

DTE2 Interface

The top-level object in the Visual Studio automation object model.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)
[GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")]
public interface DTE2 : _DTE

The DTE2 type exposes the following members.

  Name Description
Public property ActiveDocument (Inherited from _DTE.)
Public property ActiveDocument Gets the active document.
Public property ActiveSolutionProjects (Inherited from _DTE.)
Public property ActiveSolutionProjects Gets an array of currently selected projects.
Public property ActiveWindow (Inherited from _DTE.)
Public property ActiveWindow Gets the currently active window, or the top-most window if no others are active.
Public property AddIns (Inherited from _DTE.)
Public property AddIns Gets the AddIns collection, which contains all currently available Add-ins.
Public property Application (Inherited from _DTE.)
Public property Application Infrastructure. Microsoft Internal Use Only.
Public property CommandBars (Inherited from _DTE.)
Public property CommandBars Gets a reference to the development environment's CommandBars object.
Public property CommandLineArguments (Inherited from _DTE.)
Public property CommandLineArguments Gets a string representing the command line arguments.
Public property Commands (Inherited from _DTE.)
Public property Commands Gets the Commands collection.
Public property ContextAttributes (Inherited from _DTE.)
Public property ContextAttributes Gets a ContextAttributes collection which allows automation clients to add new attributes to the current selected items in the Dynamic Help window and provide contextual help for the additional attributes.
Public property Debugger (Inherited from _DTE.)
Public property Debugger Gets the debugger objects.
Public property DisplayMode (Inherited from _DTE.)
Public property DisplayMode Gets or sets the display mode, either MDI or Tabbed Documents.
Public property Documents (Inherited from _DTE.)
Public property Documents Gets the collection of open documents in the development environment.
Public property DTE (Inherited from _DTE.)
Public property DTE Gets the top-level extensibility object.
Public property Edition (Inherited from _DTE.)
Public property Edition Gets a description of the edition of the environment.
Public property Events (Inherited from _DTE.)
Public property Events Gets a reference to the Events object.
Public property FileName (Inherited from _DTE.)
Public property FileName Infrastructure. Microsoft Internal Use Only.
Public property Find (Inherited from _DTE.)
Public property Find Gets the Find object that represents global text find operations.
Public property FullName (Inherited from _DTE.)
Public property FullName Gets the full path and name of the object's file.
Public property Globals (Inherited from _DTE.)
Public property Globals Gets the Globals object that contains Add-in values that may be saved in the solution (.sln) file, the project file, or in the user's profile data.
Public property IsOpenFile[String, String] (Inherited from _DTE.)
Public property IsOpenFile[String, String] Infrastructure. Microsoft Internal Use Only.
Public property ItemOperations (Inherited from _DTE.)
Public property ItemOperations Gets the ItemOperations object.
Public property LocaleID (Inherited from _DTE.)
Public property LocaleID Gets the ID of the locale in which the development environment is running.
Public property Macros (Inherited from _DTE.)
Public property Macros Gets the Macros object.
Public property MacrosIDE (Inherited from _DTE.)
Public property MacrosIDE Gets the root of the Macros IDE's automation model.
Public property MainWindow (Inherited from _DTE.)
Public property MainWindow Gets a Window object representing the main development environment window.
Public property Mode (Inherited from _DTE.)
Public property Mode Gets the mode of the development environment, either debug or design.
Public property Name (Inherited from _DTE.)
Public property Name Gets the name of the DTE.
Public property ObjectExtenders (Inherited from _DTE.)
Public property ObjectExtenders Gets the ObjectExtenders object.
Public property Properties[String, String] (Inherited from _DTE.)
Public property Properties[String, String] Gets a Properties collection representing all available categories and subcategories contained in the Options dialog box on the Tools menu.
Public property RegistryRoot (Inherited from _DTE.)
Public property RegistryRoot Gets a string with the path to the root of the Visual Studio registry settings.
Public property SelectedItems (Inherited from _DTE.)
Public property SelectedItems Gets a collection containing the items currently selected in the environment.
Public property Solution (Inherited from _DTE.)
Public property Solution Gets the Solution object that represents all open projects in the current instance of the environment and allows access to the build objects.
Public property SourceControl (Inherited from _DTE.)
Public property SourceControl Gets a SourceControl object that allows you to manipulate the source code control state of the file behind the object.
Public property StatusBar (Inherited from _DTE.)
Public property StatusBar Gets the StatusBar object, representing the status bar on the main development environment window.
Public property SuppressUI (Inherited from _DTE.)
Public property SuppressUI Gets or sets a value indicating whether user interface (UI) should be displayed during the execution of automation code.
Public property ToolWindows Gets a ToolWindows object used as a shortcut for finding tool windows.
Public property UndoContext (Inherited from _DTE.)
Public property UndoContext Gets the global UndoContext object.
Public property UserControl (Inherited from _DTE.)
Public property UserControl Gets a value indicating whether the environment was started by a user or by automation.
Public property Version (Inherited from _DTE.)
Public property Version Gets the host application's version number.
Public property WindowConfigurations (Inherited from _DTE.)
Public property WindowConfigurations Gets the WindowConfigurations collection, representing all available window configurations.
Public property Windows (Inherited from _DTE.)
Public property Windows Gets a Windows collection containing the windows that display in the object.
Top
  Name Description
Public method ExecuteCommand(String, String) (Inherited from _DTE.)
Public method ExecuteCommand(String, String) Executes the specified command.
Public method GetObject(String) (Inherited from _DTE.)
Public method GetObject(String) Gets an interface or object that is late-bound to the DTE object and can be accessed by name at run time.
Public method GetThemeColor Gets a color used to draw the user interface within Visual Studio.
Public method LaunchWizard(String, Object[]) (Inherited from _DTE.)
Public method LaunchWizard(String, Object[]) Runs a wizard with the supplied parameters.
Public method OpenFile(String, String) (Inherited from _DTE.)
Public method OpenFile(String, String) Infrastructure. Microsoft Internal Use Only.
Public method Quit() (Inherited from _DTE.)
Public method Quit() Closes the Visual Studio environment.
Public method SatelliteDllPath(String, String) (Inherited from _DTE.)
Public method SatelliteDllPath(String, String) Returns the computed path to the satellite DLL when given the installation directory for an Add-in or wizard and the file name of the DLL containing localized resources.
Top

The DTE object is provided to you by the OnConnection method that you implement when you create an Add-in. The DTE object is the Application object in Visual Basic.

To access project-specific properties such as VBProjects or CSharpProjects, use the syntax DTE.GetObject("VBProjects").

For details about referencing the EnvDTE namespace and the DTE object, see Referencing Automation Assemblies and the DTE2 Object.

Sub DTEExample()
  Dim objTextDoc As TextDocument
  Dim objEP As EditPoint
  
  'Create a new text document.
  DTE2.ItemOperations.NewFile("General\Text File")
  'Get a handle to the new document.
  Set objTextDoc = DTE2.ActiveDocument.Object("TextDocument")
  Set objEP = objTextDoc.StartPoint.CreateEditPoint
  'Create an EditPoint and add some text.
  objEP.Insert "A test sentence."
End Sub
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Advertisement