Export (0) Print
Expand All
Cut
Run
Expand Minimize

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 =  _
) 
[C++]
HRESULT __stdcall Save(
   BSTR FileName
);
[C#]
void Save(
   string FileName
);
[JScript .NET]
public function Save(
   FileName : String
)

Parameters

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

Remarks

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.

Example

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.
   proj.Save("c:\temp2\myproj.vbproj")
   msg = "Created new solution: " & soln.FullName & vbCrLf
   msg = msg & "Created new project: " & proj.Name
   MsgBox(msg)
End Sub

See Also

SaveAll Method | Saved Property (General Extensibility)

Applies To: Project Object | ProjectItem Object

Show:
© 2014 Microsoft