Share via


DTE Interface

The top-level object in the Visual Studio automation object model. Use this object for functionality and refer to _DTE for this object’s documentation.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("04A72314-32E9-48E2-9B87-A63603454F3E")> _
Public Interface DTE _
    Inherits _DTE
[GuidAttribute("04A72314-32E9-48E2-9B87-A63603454F3E")]
public interface DTE : _DTE
[GuidAttribute(L"04A72314-32E9-48E2-9B87-A63603454F3E")]
public interface class DTE : _DTE
[<GuidAttribute("04A72314-32E9-48E2-9B87-A63603454F3E")>]
type DTE =  
    interface 
        interface _DTE 
    end
public interface DTE extends _DTE

The DTE type exposes the following members.

Properties

  Name Description
Public property ActiveDocument Gets the active document. (Inherited from _DTE.)
Public property ActiveSolutionProjects Gets an array of currently selected projects. (Inherited from _DTE.)
Public property ActiveWindow Returns the currently active window, or the top-most window if no others are active. (Inherited from _DTE.)
Public property AddIns Gets the AddIns collection, which contains all currently available Add-ins. (Inherited from _DTE.)
Public property Application Infrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public property CommandBars Gets a reference to the development environment's command bars. (Inherited from _DTE.)
Public property CommandLineArguments Gets a string representing the command line arguments. (Inherited from _DTE.)
Public property Commands Returns the Commands collection. (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. (Inherited from _DTE.)
Public property Debugger Gets the debugger objects. (Inherited from _DTE.)
Public property DisplayMode Gets the display mode, either MDI or Tabbed Documents. (Inherited from _DTE.)
Public property Documents Gets the collection of open documents in the development environment. (Inherited from _DTE.)
Public property DTE Gets the top-level extensibility object. (Inherited from _DTE.)
Public property Edition Gets a description of the edition of the environment. (Inherited from _DTE.)
Public property Events Gets a reference to the Events object. (Inherited from _DTE.)
Public property FileName Infrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public property Find Gets the Find object that represents global text find operations. (Inherited from _DTE.)
Public property FullName Gets the full path and name of the object's file. (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. (Inherited from _DTE.)
Public property IsOpenFile Infrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public property ItemOperations Gets the ItemOperations object. (Inherited from _DTE.)
Public property LocaleID Gets the ID of the locale in which the development environment is running. (Inherited from _DTE.)
Public property Macros Gets the Macros object. (Inherited from _DTE.)
Public property MacrosIDE Gets the root of the Macros IDE's automation model. (Inherited from _DTE.)
Public property MainWindow Gets a Window object representing the main development environment window. (Inherited from _DTE.)
Public property Mode Gets the mode of the development environment, either debug or design. (Inherited from _DTE.)
Public property Name Sets or gets the name of the _DTE object. (Inherited from _DTE.)
Public property ObjectExtenders Gets the ObjectExtenders object. (Inherited from _DTE.)
Public property Properties Returns a Properties collection representing all available categories and subcategories contained in the Options dialog box on the Tools menu. (Inherited from _DTE.)
Public property RegistryRoot Gets a string with the path to the root of the Visual Studio registry settings. (Inherited from _DTE.)
Public property SelectedItems Gets a collection containing the items currently selected in the environment. (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. (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. (Inherited from _DTE.)
Public property StatusBar Gets the StatusBar object, representing the status bar on the main development environment window. (Inherited from _DTE.)
Public property SuppressUI Gets or sets whether UI should be displayed during the execution of automation code. (Inherited from _DTE.)
Public property UndoContext Gets the global UndoContext object. (Inherited from _DTE.)
Public property UserControl Sets or gets a value indicating whether the environment was launched by a user or by automation. (Inherited from _DTE.)
Public property Version Gets the host application's version number. (Inherited from _DTE.)
Public property WindowConfigurations Gets the WindowConfigurations collection, representing all available window configurations. (Inherited from _DTE.)
Public property Windows Gets a Windows collection containing the windows that display in the object. (Inherited from _DTE.)

Top

Methods

  Name Description
Public method ExecuteCommand Executes the specified command. (Inherited from _DTE.)
Public method GetObject Gets an interface or object that is late-bound to the DTE object and can be accessed by name at run time. (Inherited from _DTE.)
Public method LaunchWizard Runs a wizard with the supplied parameters. (Inherited from _DTE.)
Public method OpenFile Infrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public method Quit Closes the environment. (Inherited from _DTE.)
Public method SatelliteDllPath 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. (Inherited from _DTE.)

Top

Remarks

The DTE object is provided 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.

Examples

Sub DTEExample()
    Dim objTextDoc As TextDocument
    Dim objEP As EditPoint
    
    ' Create a new text document.
    DTE.ItemOperations.NewFile("General\Text File")
    ' Get a handle to the new document.
    Set objTextDoc = DTE.ActiveDocument.Object("TextDocument")
    Set objEP = objTextDoc.StartPoint.CreateEditPoint
    ' Create an EditPoint and add some text.
    objEP.Insert "A test sentence."
End Sub

See Also

Reference

EnvDTE Namespace