Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

_Solution.SaveAs Method

Saves the solution.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)
void SaveAs(
	string FileName
)

Parameters

FileName
Type: System.String
Required. The filename in which to save the solution. If the file exists, it is overwritten.

Saves the solution with the specified file name.

public void SaveAsExample(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);
        }
    }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.