Export (0) Print
Expand All
Cut
Run
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

SaveAs Method (General Extensibility)

Visual Studio .NET 2003

Saves the solution, project, or project item.

[Visual Basic .NET]
Public Sub SaveAs( _
   ByVal NewFileName As String _
) 
[Visual Basic 6]
Sub SaveAs( _
   ByVal NewFileName As String _
) 
[C++]
HRESULT __stdcall SaveAs(
   BSTR NewFileName
);
[C#]
void SaveAs(
   string NewFileName
);
[JScript .NET]
public function SaveAs(
   NewFileName : String
)

Parameters

NewFileName
Required. The filename in which to save the solution, project, or project item. If the file exists, it is overwritten.

Remarks

Saves the project item with the specified file name.

Example

Sub SaveAsExample()
   ' This function creates a solution and adds a Visual Basic .NET Console
   ' project to it. 
   Dim soln As Solution
   Dim proj As Project
   Dim msg As String

   ' Create a reference to the solution.
   soln = DTE.Solution

   ' Create a new solution.
   soln.Create("c:\temp2", "MyNewSolution")

   ' Create a new VB Console application project. Adjust the save paths 
   ' below as needed.
   proj = soln.AddFromTemplate("D:\Program Files\Microsoft Visual Studio .NET\Vb7\VBWizards\ConsoleApplication\Templates\1033\ConsoleApplication.vbproj", "c:\temp2", "My New Project", True)
   ' Save the new solution and project.
   soln.SaveAs("c:\temp2\newsolution.sln")
   msg = "Created new solution: " & soln.FullName & vbCrLf
   msg = msg & "Created new project: " & proj.Name
   MsgBox(msg)
End Sub

See Also

IsOpen Property (Solution Object) | Open Method (General Extensibility) | Saved Property (General Extensibility)

Applies To: Project Object | ProjectItem Object | Solution Object

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.