Project.Delete 方法
从当前解决方案中移除项目。
请注意此方法当前不执行任何操作。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
Sub Delete
void Delete()
void Delete()
abstract Delete : unit -> unit
function Delete()
示例
Public Sub CodeExample(ByVal dte As DTE2)
Try
' Open a project before running this sample.
Dim prj As Project = dte.Solution.Projects.Item(1)
Dim prjs As Projects
Dim del As DialogResult
del = MessageBox.Show("Delete project from solution?", "Delete Method", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If del = DialogResult.Yes Then
prj.Delete()
End If
del = MessageBox.Show("Save project as another filename?", "SaveAs Method", MessageBoxButtons.YesNo)
If del = DialogResult.Yes Then
prj.SaveAs(Interaction.InputBox("Save this project with new name: ", "SaveAs Method", "MyProjectWithNewName", 300, 300))
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
public void CodeExample(DTE2 dte)
{
try
{ // Open a project before running this sample.
Project prj = dte.Solution.Projects.Item(1);
Projects prjs;
DialogResult del;
del = MessageBox.Show("Delete project from solution?", "Delete Method", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (del == DialogResult.Yes)
prj.Delete();
del = MessageBox.Show("Save project as another filename?", "SaveAs Method", MessageBoxButtons.YesNo);
if (del == DialogResult.Yes)
{
prj.SaveAs(Interaction.InputBox("Save this project with new name: ", "SaveAs Method",
"MyProjectWithNewName", 300, 300));
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。