This documentation is archived and is not being maintained.

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 _
HRESULT __stdcall SaveAs(
   BSTR NewFileName
void SaveAs(
   string NewFileName
[JScript .NET]
public function SaveAs(
   NewFileName : String


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


Saves the project item with the specified file name.


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.
   msg = "Created new solution: " & soln.FullName & vbCrLf
   msg = msg & "Created new project: " & proj.Name
End Sub

See Also

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

Applies To: Project Object | ProjectItem Object | Solution Object