Freigeben über


VSProjectItem.DTE Property

Returns the top-level extensibility object.

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

Syntax

'Declaration
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
    DTE^ get ();
}
abstract DTE : DTE with get
function get DTE () : DTE

Property Value

Type: EnvDTE.DTE
Returns a DTE object.

Remarks

In Visual Studio, the DTE object is the root of the automation model, which other object models often call "Application".

Examples

Public Sub PrjDTE(ByVal dte As DTE2)
    ' List the parent object for the first VSProjectItem.
    ' Before running, open a VB or C# application in VS.
    Dim vsPrj As VSProject = _
    CType(dte.Solution.Projects.Item(1).Object, _
    VSProject)
    Dim vsPrjItem As VSProjectItem

    vsPrjItem = CType(dte.Solution.Projects.Item(1) _
    .ProjectItems.Item(1).Object, VSProjectItem)
    MsgBox("Parent object for VSProjectItem: " & vsPrjItem.DTE)
End Sub
public void PrjDTE(DTE2 dte)
{
    // Lists the parent object for the first VSProjectItem.
    // Before running, open a VB or C# application in VS.
    VSProject vsPrj = (VSProject)dte.Solution.
    Projects.Item(1).Object;
    VSProjectItem vsPrjItem;

    vsPrjItem = (VSProjectItem)dte.Solution.
    Projects.Item(1).ProjectItems.Item(1).Object;
    MessageBox.Show("Parent object for VSProjectItem" + vsPrjItem.DTE);
}

.NET Framework Security

See Also

Reference

VSProjectItem Interface

VSLangProj Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples