다음을 통해 공유


_Solution.Open 메서드

지정된 뷰에서 솔루션을 엽니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Sub Open ( _
    FileName As String _
)
void Open(
    string FileName
)
void Open(
    [InAttribute] String^ FileName
)
abstract Open : 
        FileName:string -> unit 
function Open(
    FileName : String
)

매개 변수

  • FileName
    형식: System.String
    필수적 요소로서,열려는 파일의 이름입니다.

예제

Sub OpenExample(ByVal dte As DTE2)

    ' Create the full pathname to NewSolution.sln.
    Dim tempPath As String = System.IO.Path.GetTempPath()
    Dim solnName As String = "NewSolution"
    Dim solnPath As String = tempPath & solnName & ".sln"

    ' Try to open NewSolution.sln.
    Try
        dte.Solution.Open(solnPath)
    Catch ex As ArgumentException
        If MsgBox("Solution " & solnPath & " doesn't exist. " & _
            "Create it?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            ' Create and save NewSolution.sln.
            dte.Solution.Create(tempPath, solnName)
            dte.Solution.SaveAs(solnPath)
        End If
    End Try

End Sub
public void OpenExample(DTE2 dte)
{
    // Create the full pathname to NewSolution.sln.
    string tempPath = System.IO.Path.GetTempPath();
    string solnName = "NewSolution";
    string solnPath = tempPath + solnName + ".sln";

    // Try to open NewSolution.sln.
    try
    {
        dte.Solution.Open(solnPath);
    }
    catch (Exception ex)
    {
        if (MessageBox.Show("Solution " + solnPath + 
            " doesn't exist. " + "Create it?", "", 
            MessageBoxButtons.YesNo) == DialogResult.Yes)
        {
            // Create and save NewSolution.sln.
            dte.Solution.Create(tempPath, solnName);
            dte.Solution.SaveAs(solnPath);
        }
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

_Solution 인터페이스

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행