AddFromFile Method (Solution Object)
Visual Studio .NET 2003
Adds a project to the solution, based on a project file already stored in the system.
[Visual Basic .NET]
Public Function AddFromFile( _ ByVal FileName As String, _ Optional ByVal Exclusive As Boolean = False _ ) As Project
[Visual Basic 6]
Function AddFromFile( _ ByVal FileName As String, _ Optional ByVal Exclusive As Boolean = False _ ) As Project
[C++]
HRESULT __stdcall AddFromFile( BSTR FileName, VARIANT_BOOL Exclusive, /* [out, retval] */ Project** retVal );
[C#]
Project AddFromFile( string FileName, bool Exclusive );
[JScript .NET]
public function AddFromFile( FileName : String, Exclusive : Boolean ) : Project
Parameters
- FileName
- Required. The full path and file name of the project file.
- Exclusive
- Optional. Indicates whether the project loads in the current solution or its own; True if the current solution is closed and the project is added to a new solution, False if the project is added to the existing open solution.
Return Value
Returns a Project object.
Remarks
You can use the LaunchWizard method rather than AddFromFile to execute a wizard if you want to suppress its UI during execution. LaunchWizard has a parameter that allows you to disable the UI.
Example
Sub AddFromFileExample()
' This function creates a solution and adds a Visual Basic .NET Console
' project to it.
Dim soln As Solution
' Create a reference to the solution.
soln = DTE.Solution
' Create a new solution.
soln.Create("c:\temp2", "MyNewSolution")
' Add an existing project to the new solution.
soln.AddFromFile("c:\temp\SomeProj.vbproj")
End Sub
See Also
AddFromTemplate Method (Solution Object) | LaunchWizard Method (DTE Object) | Open Method (General Extensibility) | Remove Method (Solution Object)
Applies To: Solution Object