This topic has not yet been rated - Rate this topic

Solution4.Create Method (String, String)

Creates an empty solution in the specified directory with the specified name.

Namespace:  EnvDTE100
Assembly:  EnvDTE100 (in EnvDTE100.dll)
void Create(
	string Destination,
	string Name
)

Parameters

Destination
Type: System.String
Required. The directory in which to create the .sln and .suo (solution) files.
Name
Type: System.String
Required. The name to display in Solution Explorer. This is also the base name of the .sln and .suo files.

Implements

Solution3.Create(String, String)

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.
    CreateExample((DTE2)_applicationObject);
}
public void CreateExample(DTE2 dte)
{
    // This add-in creates a solution.
    try
    {
        Solution4 soln = (Solution4)_applicationObject.Solution;
        MessageBox.Show("Creating a  solution ");
        // Make sure that the file path below exists on your computer.
        // You can modify the path.
        soln.Create("c:\temp2", "ANewSoln2.sln");
    }
    catch(SystemException ex)
    {
    MessageBox.Show("ERROR: " + ex);
    }
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Advertisement