Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft das Erweiterbarkeitsobjekt der obersten Ebene ab.
Namespace: VSLangProj80
Assembly: VSLangProj80 (in VSLangProj80.dll)
Syntax
'Declaration
ReadOnly Property DTE As DTE
DTE DTE { get; }
property DTE^ DTE {
DTE^ get ();
}
abstract DTE : DTE
function get DTE () : DTE
Eigenschaftswert
Typ: EnvDTE.DTE
Gibt ein DTE-Objekt zurück.
Hinweise
In Visual Studio stellt das DTE-Objekt das Stammobjekt des Automatisierungsmodells dar, das in anderen Objektmodellen häufig als "Anwendung" bezeichnet wird.
Beispiele
Um dieses Beispiel als Add-In auszuführen, informieren Sie sich unter Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell.Öffnen Sie ein Visual Basic- oder ein Visual C#-Projekt, bevor Sie dieses Beispiel ausführen.
[Visual Basic]
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
applicationObject = CType(application, DTE2)
addInInstance = CType(addInInst, AddIn)
DTESample(applicationObject)
End Sub
Sub DTESample(ByVal dte As DTE2)
Dim aProject As Project
Dim aVSProject As VSProject2
aProject = applicationObject.Solution.Projects.Item(1)
aVSProject = CType(applicationObject.Solution.Projects.Item(1)._
Object, VSProject2)
' Reach the DTE object through a VSProject object.
aVSProject.Project.DTE.ItemOperations.NewFile _
("General\Text File", "MyTextFile")
End Sub
[C#]
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
applicationObject = (DTE2)application;
addInInstance = (AddIn)addInInst;
DTESample(((DTE2)applicationObject));
}
public void DTESample(DTE2 dte)
{
Project aProject = null;
VSProject2 aVSProject = null;
aProject = applicationObject.Solution.Projects.Item(1);
aVSProject = ((VSProject2)
( applicationObject.Solution.Projects.Item(1).Object));
// Reach the DTE object through a VSProject object.
aVSProject.Project.DTE.ItemOperations.NewFile
(@"General\Text File","", "{00000000-0000-0000-0000-000000000000}" );
}
.NET Framework-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter Verwenden von Bibliotheken aus teilweise vertrauenswürdigem Code.