Skip to main content

Save a project

To save a project, use the IWorkspace object's method. The IWorkspace object can be obtained by using the Workspace property of the IApplication object.

Save overwriting

To save a project, use the SaveProject method of the IWorkspace object.

public void SaveProject(ICommandContext c, ICommandParams p) 
{
//Save the current project
c.App.Workspace.SaveProject();
}

Save as

To save as, specify the file name with the SaveProjectAs method of the IWorkspace object. Also, for UI interaction, you can display a dialog by using the ShowSaveFileDialog method of the ICommonUI object.

protected void SaveProjectAs(ICommandContext c, ICommandParams p) 
{
//Select the project file to save
var newProjectFilePath = c.App.Window.UI.ShowSaveFileDialog("Save the project with a name", "Project file|*.iproj;*.nproj");
if ( newProjectFilePath == null )
{
//Exit if canceled
return;
}

c.App.Workspace.SaveProjectAs(newProjectFilePath);
}
Note

Please note that when you use the IWorkspace.SaveProjectAs method, the split model files will be merged into one.