Solution4::AddFromTemplate Method (String^, String^, String^, Boolean)

 

Copies an existing project file, and any items or subdirectories it contains, to the specified location and adds it to the solution.

Namespace:   EnvDTE100
Assembly:  EnvDTE100 (in EnvDTE100.dll)

Project^ AddFromTemplate(
	String^ FileName,
	String^ Destination,
	String^ ProjectName,
	bool Exclusive = true
)

Parameters

FileName
Type: System::String^

Required. The full path and file name with extension of the template project file.

Destination
Type: System::String^

Required. The full path of the directory in which to copy the contents of FileName.

ProjectName
Type: System::String^

Required. The name of the project file in the destination directory. This should include the extension. The displayed name is derived from ProjectName.

Exclusive
Type: System::Boolean

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

Type: EnvDTE::Project^

A Project object.

The name of the project displayed in Solution Explorer is ProjectName without the file extension. AddFromTemplate fails if the new project file name already exists in the destination.

System_CAPS_noteNote

For Visual Basic and Visual C# projects: The returned Project object has a value of Nothing or null. You can find the created Project object by iterating through the DTE.Solution.Projects collection by using the ProjectName parameter to identify the newly created project.

No code example is currently available or this language may not be supported.
Return to top
Show: