Udostępnij za pośrednictwem


Solution2.Open(String) Method

Definition

Opens a specified solution.

public:
 void Open(System::String ^ FileName);
public:
 void Open(Platform::String ^ FileName);
void Open(std::wstring const & FileName);
[System.Runtime.InteropServices.DispId(17)]
public void Open (string FileName);
[<System.Runtime.InteropServices.DispId(17)>]
abstract member Open : string -> unit
Public Sub Open (FileName As String)

Parameters

FileName
String

Required. The file name of the file to open.

Implements

Attributes

Examples

Sub SolnOpenExample(ByVal dte As DTE2)  
    ' Opens a solution.  
    Dim soln As Solution2 = CType(dte.Solution, Solution2)  
    ' Try to open the solution.  
    Try  
        ' Make sure you replace <file path>   
        ' below with an actual path,  
        ' and <solution.sln> with an actual solution file.  
        soln.Open("<file path>\<solution.sln>")  
        Catch ex As SystemException  
            MsgBox("ERROR: " & ex.ToString())  
        End Try  
    End Sub  
using System.Windows.Forms;  
public void SolnOpenExample(DTE2 dte)  
{  
    // Opens a solution.  
    try  
    {  
        Solution2 soln = (Solution2)_applicationObject.Solution;  
        // Make sure you replace <filepath> below   
        // with an actual path  
        // and <solution.sln> with an actual solution file.  
        soln.Open(@"<file path>\<solution.sln>");  
    }  
    catch (SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Applies to