Solution4.Close(Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
关闭当前解决方案。
void Close(bool SaveFirst = true);
[System.Runtime.InteropServices.DispId(18)]
public void Close (bool SaveFirst = true);
[<System.Runtime.InteropServices.DispId(18)>]
abstract member Close : bool -> unit
Public Sub Close (Optional SaveFirst As Boolean = true)
参数
- SaveFirst
- Boolean
可选。 指示是否在关闭之前保存解决方案;如果应该在关闭之前保存解决方案,则为 true,否则为 false。
实现
- 属性
示例
Sub SolnCloseExample(ByVal dte As DTE2)
' Close a solution.
' Make sure you have a solution open in Visual Studio before running this example.
Try
Dim soln As Solution4 = CType(_applicationObject.Solution, _
Solution4)
Dim solnName As String = _
System.IO.Path.GetFileNameWithoutExtension(soln.FullName)
MsgBox("Closing the solution " & solnName)
soln.Close()
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
using System.Windows.Forms;
public void SolnCloseExample(DTE2 dte)
{
// Close a 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("Closing the solution " + solnName);
soln.Close(true);
}
catch(SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}