Project and item templates

Project and item templates provide reusable stubs that give users some basic code and structure, that they can customize for their own purposes.

Visual Studio templates

A number of predefined project and item templates are installed with Visual Studio. For example, the Visual Basic and C# Windows Forms App and Class Library templates that are shown in the New Project dialog box are project templates. Item templates show in the Add New Item dialog box, and include items such as code files, XML files, HTML pages, and Style Sheets.

These templates provide a starting point for users to begin creating projects, or to expand existing projects. Project templates provide the files that are required for a particular project type, include standard assembly references, and set default project properties and compiler options. Item templates can range in complexity from a single empty file that has a certain file extension, to multiple source code files with stub code, designer information files, and embedded resources.

You can use installed templates in the New Project and Add New Item dialog boxes, author your own templates, or download and use templates created by the community. For more information, see How to: Create project templates and How to: Create item templates.

Contents of a template

All project and item templates, whether installed with Visual Studio or created by you, function using the same principles and have similar contents. All templates contain the following items:

  • The files to be created when the template is used. These files include source code files, embedded resources, project files, and so on.

  • One .vstemplate file, containing the metadata needed to display the template in the New Project and Add New Item dialog boxes and create a project or item from the template. For more information about .vstemplate files, see Template parameters.

When these files are compressed into a .zip file and put in the correct folder, Visual Studio automatically displays them in the following places:

  • Project templates appear in the New Project dialog box.

  • Item templates appear in the Add New Item dialog box.

For more information about template folders, see How to: Locate and organize templates.

See also