ProjectItems.AddFromTemplate Method
Creates a new project item from an existing item template file and adds it to the project.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Function AddFromTemplate ( _
FileName As String, _
Name As String _
) As ProjectItem
ProjectItem AddFromTemplate(
string FileName,
string Name
)
ProjectItem^ AddFromTemplate(
[InAttribute] String^ FileName,
[InAttribute] String^ Name
)
abstract AddFromTemplate :
FileName:string *
Name:string -> ProjectItem
function AddFromTemplate(
FileName : String,
Name : String
) : ProjectItem
Parameters
FileName
Type: System.StringRequired. The full path and file name of the template project file.
Name
Type: System.StringRequired. The file name to use for the new project item.
Return Value
Type: EnvDTE.ProjectItem
A null reference.
Remarks
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.
Note
The ProjectItems.AddFromTemplate method always returns nulla null reference (Nothing in Visual Basic). In order to retrieve the added ProjectItem, you can interate through the ProjectItems collection, or use the ProjectItemEvents.ItemAdded event.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.