Solution4.AddSolutionFolder(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将解决方案文件夹添加到 ProjectItems 集合中。
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
参数
- Name
- String
解决方案文件夹的名称。
返回
Project 对象。
实现
- 属性
示例
Sub SolnFolderExample(ByVal dte As DTE2)
' Add a new folder to an existing solution.
Try
Dim soln As Solution4 = _
CType(_applicationObject.Solution, Solution4)
Dim solnName As String = _
System.IO.Path.GetFileNameWithoutExtension(soln.FullName)
MsgBox("Adding a new folder to " & solnName)
soln.AddSolutionFolder("MynewFolder")
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
using System.Windows.Forms;
public void AddSolnFolderExample(DTE2 dte)
{
// Add a folder to an existing solution.
// Open a solution in Visual Studio before running this example.
try
{
Solution4 soln = (Solution4)_applicationObject.Solution;
string solnName =
System.IO.Path.GetFileNameWithoutExtension(soln.FullName);
MessageBox.Show("Adding a folder to the solution " + solnName);
soln.AddSolutionFolder("MyNewFolder");
}
catch(SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}
注解
AddSolutionFolder 返回一个 Project 对象,该对象可将 (QI) 转换或查询接口转换为 SolutionFolder 对象。