Udostępnij za pośrednictwem


How to: Create Project Templates

This procedure enables you to create a template using the Export Template wizard, which packages your template in a .zip file. You can also create templates in the VSIX file format for improved deployment by using the Export Template Wizard extension, or with templates included in the Visual Studio SDK, or you can create templates manually. For a comparison of different template creation strategies, see Creating Project and Item Templates.

Note

You create Visual C++ templates differently from other language templates. For more information, see Designing a Wizard and Inside Visual C++ Wizards.

To create a custom project template with the standard Export Template wizard

  1. Create a project.

    Note

    Use only valid identifier characters when naming a project that will be the source for a template. A template exported from a project named with invalid characters can cause compilation errors in future projects based on the template. For more information on valid identifier characters, see Declared Element Names (Visual Basic).

  2. Edit the project until it is ready to be exported as a template.

  3. As appropriate, edit the code files to indicate where parameter replacement should take place. For more information on parameter replacement, see How to: Substitute Parameters in a Template.

  4. On the File menu, click Export Template. The Export Template wizard opens.

  5. Click Project Template.

  6. If you have more than one project in your current solution, select the projects you want to export to a template.

  7. Click Next.

  8. Select an icon and a preview image for your template. These will appear in the New Project dialog box.

  9. Enter a template name and description.

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

    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 Creating Extensions By Using the VSIX Project Template.

See Also

Tasks

How to: Manually Create Project Templates

Other Resources

Creating Project and Item Templates