Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Pass Custom Parameters to Templates 

You can use the CustomParameter element in your .vstemplate file to add new parameters to a template. For a complete list of template parameters, see Template Parameters.

To add a custom parameter

  1. Locate the TemplateContent element in the .vstemplate file for the template.

  2. Add a CustomParameters element and one or more CustomParameter child elements as children of the TemplateContent element. For example:

    <TemplateContent>
        ...
        <CustomParameters>
            <CustomParameter Name="$MyParameter1$" Value="MyValue2"/>
            <CustomParameter Name="$MyParameter2$" Value="MyValue2">
        </CustomParameters>
    </TemplateContent>
    
  3. Use the parameter in one or more of the code files in the template. For example:

    string Value1 = "$MyParameter1"
    string Value2 = "$MyParameter2"
    

    When a project is created from the template, the values set by the Value attributes of the CustomParameter elements corresponding to the parameters will replace the parameters in the code files.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft