Solution4.Remove(Project) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从解决方案中删除指定的项目。
public:
void Remove(EnvDTE::Project ^ proj);
public:
void Remove(EnvDTE::Project ^ proj);
void Remove(EnvDTE::Project const & proj);
[System.Runtime.InteropServices.DispId(25)]
public void Remove (EnvDTE.Project proj);
[<System.Runtime.InteropServices.DispId(25)>]
abstract member Remove : EnvDTE.Project -> unit
Public Sub Remove (proj As Project)
参数
- proj
- Project
必需。 要从解决方案中删除的项目。
实现
- 属性
示例
Sub SolnRemoveExample(ByVal dte As DTE2)
' Remove a project from a solution.
' Open a solution that contains at least one project
' in Visual Studio.
Dim soln As Solution2 = CType(dte.Solution, Solution2)
Dim proj As Project = soln.Projects.Item(1)
Try
' Delete the first project in the solution.
MsgBox("Ready to delete the project.")
soln.Remove(proj)
MsgBox("Project was deleted from the solution.")
' Close the solution from the IDE.
soln.Close()
Catch ex As SystemException
MsgBox("ERROR: " & ex.ToString())
End Try
End Sub
using System.Windows.Forms;
public void SolnOpenExample(DTE2 dte)
{
// Remove the first project from a solution.
// Open a solution that contains at least one project before
// running this example.
Solution2 soln = (Solution2)_applicationObject.Solution;
Project proj = soln.Projects.Item(1);
try
{
// Delete the first project in the solution.
MessageBox.Show("Ready to delete the project.");
soln.Remove(proj);
MessageBox.Show("Project was deleted from the solution.");
// Close the solution from the IDE.
soln.Close(false);
}
catch (SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}