Solution-Schnittstelle

Aktualisiert: November 2007

Stellt alle Projekte und projektmappenweiten Eigenschaften in der integrierten Entwicklungsumgebung (IDE) dar. Verwenden Sie dieses Objekt für Funktionalität, und verweisen Sie für die Dokumentation auf _Solution.

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

Syntax

<GuidAttribute("26F6CC4B-7A48-4E4D-8AF5-9E960232E05F")> _
Public Interface Solution _
    Implements _Solution

Dim instance As Solution
[GuidAttribute("26F6CC4B-7A48-4E4D-8AF5-9E960232E05F")]
public interface Solution : _Solution
[GuidAttribute(L"26F6CC4B-7A48-4E4D-8AF5-9E960232E05F")]
public interface class Solution : _Solution
public interface Solution extends _Solution

Hinweise

Das Solution-Objekt ist eine Auflistung aller Projekte in der aktuellen Instanz der IDE und aller projektmappenweiten Eigenschaften, z. B. Buildkonfigurationen. Das Solution-Objekt enthält für jedes Projekt ein Projektelement, unabhängig davon, ob es sich um ein eingebundenes Projekt, ein Unterprojekt oder ein Projekt auf oberster Ebene handelt.

Auf dieses Objekt können Sie mit DTE.Solution verweisen. Verwenden Sie Solution.Item(EnvDTE.Constants.vsProjectKindMisc) oder Solution.Item(EnvDTE.Constants.vsProjectKindSolutionItems), um auf virtuelle Projekte wie MiscFiles oder SolutionItems zu verweisen.

Beispiele

Dieses Beispiel funktioniert nur in Visual Studio .NET 2003. Weitere Informationen finden Sie unter Gewusst wie: Migrieren von Code, durch den Projekte mithilfe von Vorlagen erstellt werden.

Sub SolutionExample()
   ' This function creates a solution and adds a Visual Basic Console
   ' project to it. 
   Dim soln As Solution
   Dim proj As Project
   Dim msg As String

   ' Create a reference to the solution.
   soln = DTE.Solution

   ' Create a new solution.
   soln.Create("c:\temp2", "MyNewSolution")

   ' Create a new Visual Basic Console application project.
   ' Adjust the save path as needed.
   proj = soln.AddFromTemplate("D:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033\ConsoleApplication.vbproj", "c:\temp2", "My New Project", True)
   ' Save the new solution and project.
   soln.SaveAs("c:\temp2\newsolution.sln")
   msg = "Created new solution: " & soln.FullName & vbCrLf
   msg = msg & "Created new project: " & proj.Name
   MsgBox(msg)
End Sub

Siehe auch

Referenz

Solution-Member

EnvDTE-Namespace