Solution2.AddSolutionFolder(String) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Fügt einen Projektmappenordner einer ProjectItems-Auflistung hinzu.
public:
EnvDTE::Project ^ AddSolutionFolder(System::String ^ Name);
public:
EnvDTE::Project ^ AddSolutionFolder(Platform::String ^ Name);
EnvDTE::Project AddSolutionFolder(std::wstring const & Name);
[System.Runtime.InteropServices.DispId(102)]
public EnvDTE.Project AddSolutionFolder (string Name);
[<System.Runtime.InteropServices.DispId(102)>]
abstract member AddSolutionFolder : string -> EnvDTE.Project
Public Function AddSolutionFolder (Name As String) As Project
Parameter
- Name
- String
Der Name des Projektmappenordners.
Gibt zurück
Ein Project-Objekt.
- Attribute
Beispiele
Sub SolnFolderExample(ByVal dte As DTE2)
' Adds a new folder to an existing solution.
Try
Dim soln As Solution2 = _
CType(_applicationObject.Solution, Solution2)
Dim solnName As String = _
System.IO.Path.GetFileNameWithoutExtension(soln.FullName)
MsgBox("Adding a new folder to " & solnName)
Dim Proj As Project
proj = soln.AddSolutionFolder("MynewFolder")
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
using System.Windows.Forms;
public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst,
ref System.Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
// Pass the applicationObject member variable to the code example.
AddSolnFolderExample((DTE2)_applicationObject);
}
public void AddSolnFolderExample(DTE2 dte)
{
// Adds a folder to an existing solution.
// Open a solution in
// Visual Studio before running this example.
try
{
Solution2 soln = (Solution2)_applicationObject.Solution;
string solnName =
System.IO.Path.GetFileNameWithoutExtension(soln.FullName);
MessageBox.Show("Adding a folder to the solution " + solnName);
Project proj = soln.AddSolutionFolder("MyNewFolder");
}
catch(SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}