How to: Substitute Parameters in a Template
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at How to: Substitute Parameters in a Template.
You may replace template parameters such as class names and namespaces when a file based on a template is created. For a complete list of template parameters, see Template Parameters.
You may replace parameters in the files of a template whenever a project based on that template is created. This procedure explains how to create a template that replaces the name of a namespace with the safe project name when a new project is created with the template.
To use a parameter to replace namespace name with the project name
Insert the parameter in one or more of the code files in the template. For example:
namespace $safeprojectname$
Note Template parameters are written in the format $parameter$.
In the .vstemplate file for the template, locate the
ProjectItemelement that includes this file.Set the
ReplaceParametersattribute totruefor theProjectItemelement. For example:<ProjectItem ReplaceParameters="true">Class1.cs</ProjectItem>
Creating Project and Item Templates
Template Parameters
Visual Studio Template Schema Reference
ProjectItem Element (Visual Studio Item Templates)