Muokkaa

Jaa


Create project templates

This article shows you how to create a template by using the Export Template Wizard, which packages your template in a .zip file.

Use the Export Template Wizard

  1. Create a project.

    Note

    Use only valid identifier characters when you name a project that's the source for a template. Otherwise, compilation errors can occur in projects that're created from the template. For more information about valid identifier characters, see Declared element names (Visual Basic) or Identifiers (C++). Alternatively, you can use Template parameters to use "safe" names for classes and namespaces.

  2. Edit the project until it's ready to be exported as a template. For example, you might want to edit code files to indicate where parameter replacement should take place. For more information, see How to: Substitute parameters in a template.

  3. On the Project menu, choose Export Template.

    Note

    If you don't see the Export Template menu item, you can add it by choosing Tools > Customize, and then select Commands, choose the Project menu bar, select the Add Command button, and then under Project, select Export Template....

    The Export Template Wizard opens.

  4. On the Choose Template Type page, select Project Template. Select the project you want to export to a template, and then choose Next.

  5. On the Select Template Options page, enter a name and optional description, icon image, and preview image for your template. These items will appear in the dialog box where you create a new project. Select Finish.

    The project is exported into a .zip file and placed in the specified output location, and, if selected, imported into Visual Studio.

To find your template in the dialog box where you create a new project, search for it by name or scroll through the list. (Filtering based on language or project type isn't currently possible for user templates.)

Other ways to create project templates

You can create project templates manually by gathering the files that constitute the project into a folder and creating a .vstemplate XML file with the appropriate metadata. For more information, see How to: Manually create web templates.

If you have the Visual Studio SDK installed, you can wrap the finished template in a VSIX file for deployment by using the VSIX Project template. For more information, see Get started with the VSIX project template.