Chapter 15

Project and Item Templates


  • Creating your own item templates
  • Creating your own project templates
  • Adding a wizard to your project templates

Most development teams build a set of standards that specify how they build applications. This means that every time you start a new project or add an item to an existing project, you have to go through a process to ensure that it conforms to the standard. Visual Studio 2012 enables you to create templates that can be reused without having to modify the standard item templates that ship with Visual Studio 2012. This chapter describes how you can create simple templates and then extend them with a wizard that can change how the project is generated using the IWizard interface.


Two types of templates exist: those that create new project items and those that create entire projects. Both types of templates essentially have the same structure, as you’ll see later, except that they are placed in different template folders. The project templates appear in the New Project dialog, whereas the item templates appear in the Add New Item dialog.

Item Template

Although you can build a project item template manually, it is much quicker to create one from an existing project item and make changes as required. This section begins by looking at an item template — in this case an About form that contains some basic information, such as the application’s version number and who wrote it.

To begin, create a new ...

Get Professional Visual Studio 2012 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.