다음을 통해 공유


How to: Create project templates

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This topic shows you how to create a template 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 naming a project that will be the source for a template. Otherwise, compilation errors can occur in projects that are 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 is ready to be exported as a template. For example, you might want to edit code files to indicate where parameter replacement should take place. See How to: Substitute parameters in a template.

  3. On the Project menu, choose 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.

  1. On the Select Template Options page, enter a name and optional description, icon, and preview image for your template. These items will appear in the New Project dialog box. Choose 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 New Project dialog box, expand Installed and then expand the category that corresponds to the ProjectType element in the .vstemplate file. For example, a .vstemplate file that contains <ProjectType>CSharp</ProjectType> appears under Installed > Visual C#, by default. You can organize your template into a subdirectory of the project type just by creating a folder in that directory and placing your template's .zip file in it. For more information, see How to: Locate and organize 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.

See also