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 2010 enables you to create templates that can be reused without having to modify the standard item templates that ship with Visual Studio 2010. 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 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 it is possible to 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 Windows ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.