Save Method (General Extensibility)
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Save Method (General Extensibility)

Visual Studio .NET 2003

Saves the project or project item.

[Visual Basic .NET]
Public Sub Save( _
   Optional FileName As String =  _
[Visual Basic 6]
Sub Save( _
   Optional FileName As String =  _
HRESULT __stdcall Save(
   BSTR FileName
void Save(
   string FileName
[JScript .NET]
public function Save(
   FileName : String


Optional. The name in which to save the project or project item.


If FileName cannot be written, such as when the disk is full or there are write permission problems, then Save produces an error. The file is saved with a new name based on FileName.


Sub SaveExample()
   ' 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 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

SaveAll Method | Saved Property (General Extensibility)

Applies To: Project Object | ProjectItem Object

© 2016 Microsoft