Condividi tramite


Solution3.Close(Boolean) Method

Definition

Closes the current solution.

void Close(bool SaveFirst = false);
[System.Runtime.InteropServices.DispId(18)]
public void Close (bool SaveFirst = false);
[<System.Runtime.InteropServices.DispId(18)>]
abstract member Close : bool -> unit
Public Sub Close (Optional SaveFirst As Boolean = false)

Parameters

SaveFirst
Boolean

Optional. Indicates whether to save the solution before closing it; true if the solution should be saved prior to closing it, false if not.

Implements

Attributes

Examples

Sub SolnCloseExample(ByVal dte As DTE2)  
    ' Closes a solution.  
    ' Make sure you have a solution open in Visual Studio before running this example.  
    Try  
        Dim soln As Solution3 = CType(_applicationObject.Solution, _  
        Solution3)  
        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)  
{  
    // Closes a  solution.  
    // Open a solution in Visual Studio before running this example.  
    try  
    {  
        Solution3 soln = (Solution3)_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);  
    }  
}  

Applies to