Solution4.DTE Property

Definition

Gets the top-level extensibility object.

public:
 property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
public:
 property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(10)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(10)] get; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE

Property Value

DTE

A DTE object.

Implements

DTE
Attributes

Examples

Sub Solution4Example(ByVal dte As DTE2)  
    ' This function creates a solution and adds a Visual C# Console  
    ' project to it.  
    Try  
        Dim soln As Solution4 = CType(DTE.Solution, Solution4)  
        Dim csTemplatePath As String  
        ' This path must exist on your computer.  
        ' Replace <file path> below with an actual path.  
        Dim csPrjPath As String = "<file path>"  
        MsgBox("starting")  
        ' Get the project template path for a C# console project.  
        csTemplatePath = CType(soln.GetProjectTemplate _  
        ("ConsoleApplication.zip", "CSharp"), string)  
        ' Create a new C# Console project using the template obtained   
        ' above.  
        soln.AddFromTemplate(csTemplatePath, csPrjPath, _  
        "New CSharp Console Project", False)  
        MsgBox("done")  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void Solution4Example(DTE2 dte)  
{  
    // This function creates a solution and adds a Visual C# Console  
    // project to it.  
    try{  
        Solution4 soln = (Solution4)_applicationObject.Solution;  
        String csTemplatePath;  
        // The file path must exist on your computer.  
        // Replace <file path> below with an actual path.  
        String csPrjPath = "<file path>";  
        "<file path>MessageBox.Show("Starting...");  
        "<file path>"<file path>csTemplatePath =   
        soln.GetProjectTemplate("ConsoleApplication.zip", "CSharp");  
        // Create a new C# Console project using the template obtained   
        // above.  
        soln.AddFromTemplate(csTemplatePath, csPrjPath,  
          "New CSharp Console Project", false);  
        MessageBox.Show("Done!");  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Remarks

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

Applies to