Wednesday, February 01, 2006

Visual Studio 2005 Templates

Visual Studio project and item templates provide reusable and customizable project and item stubs that accelerate the development process, removing the need to create new projects and items from scratch.

A number of predefined project and item templates are installed when you install Visual Studio. For example, the Visual Basic, Visual C#, and Visual J# Windows Appliation and Class Library templates available in the New Project dialog box are all examples project templates. Installed item templates are available from the Add New Item dialog box, and include items such as XML files, HTML pages, and Style Sheets.

These templates provide a starting point for users to begin creating new projects or expanding current projects. Project templates provide the basic files needed 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 with the correct file extension to a multi-file item containing items such as source code files with stub code, designer information files, and embedded resources.

In addition to the installed templates available in the New Project and Add New Item dialog boxes, you can author your own templates or download and use templates created by the community.

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

  • The files to create when the template is used. This includes all source code files, embedded resources, project files, etc.
  • One .vstemplate file. This file contains the metadata that provides Visual Studio with the information it needs to display the template in the New Project and Add New Item dialog boxes and create a project or item from the template.
When these files are compressed into a .zip file and placed in the proper folder, Visual Studio automatically displays them in the My Templates section of the New Project and Add New Item dialog boxes.

No comments: