ProjectItems::AddFromTemplate Method (String^, String^)

 

Creates a new project item from an existing item template file and adds it to the project.

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

ProjectItem^ AddFromTemplate(
	String^ FileName,
	String^ Name
)

Parameters

FileName
Type: System::String^

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

Name
Type: System::String^

Required. The file name to use for the new project item.

Return Value

Type: EnvDTE::ProjectItem^

A null reference.

When you call AddFromTemplate, there is no need to explicitly create a new solution (such as with DTE.Solution.Create), because AddFromTemplate automatically creates a solution.

System_CAPS_noteNote

The ProjectItems.AddFromTemplate method always returns null. In order to retrieve the added ProjectItem, you can interate through the ProjectItems collection, or use the ProjectItemEvents.ItemAdded event.

Return to top
Show: