Export (0) Print
Expand All

Solution2.Open Method 

Opens a specified solution.

Namespace: EnvDTE80
Assembly: EnvDTE80 (in envdte80.dll)

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

Parameters

FileName

Required. The file name of the file to open.

For information on how to run this add-in code, see How to: Compile and Run the Automation Object Model Code Examples.

using System.Windows.Forms;
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst,
 ref System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    SolnOpenExample((DTE2)_applicationObject);
}

public void SolnOpenExample(DTE2 dte)
{
    // This add-in 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);
    }
}

Show:
© 2014 Microsoft