Open Method
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

_Solution.Open Method

Opens the solution in the specified view.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

void Open (
	[InAttribute] string FileName
)
void Open (
	/** @attribute InAttribute() */ String FileName
)
function Open (
	FileName : String
)

Parameters

FileName

Required. The filename of the file to open.

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);
        }
    }
}
Show:
© 2016 Microsoft