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



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.

public void SolnOpenExample(DTE2 dte)
    // This add-in opens a solution.
        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);

© 2014 Microsoft