Before we start, I would like to explain the current
template structure in VS 2005. VS 2005, by default, comes with few templates
to jump start projects. For example, for Web Applications the developer can
start a project using ASP.NET Web Site, ASP.NET Web Service, Personal Web Site
Starter Kit, Empty Web Site or ASP.NET Crystal Reports Web Site. When the
developer clicks on File -> New -> Web Site, they are presented with the following
screen to choose the kind of Web site they want to create
Figure 1
The IDE picks the template information from the following
directory:
C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\ProjectTemplates\Web\VisualBasic\1033
The path mentioned above is based on the assumption that the
developer had selected the default options while installing VS 2005.
If you take a look at the files under the above folder, you
will notice that for each of the Web Options you have a zip file. This zip
file contains all the files needed to create the project. It also contains one
extra file with the extension as vstemplate. This file contains all the
information it needs to create the project and add appropriate files to the
project. The vstemplate file stores the Meta data on the project templates in
XML format.
In short, to create a template you need to create a
vstemplate file and a zip file of all files needed to create the project. However,
the question arises about where we store the zip file. The readers would
assume the zip file is stored under the same folder, but in reality VS 2005
allows you to store templates wherever you want. You can even store the
templates on the network drive. This is a big help for developers working in a
team. In order to make VS 2005 aware of these templates we need to make some
minor changes. You can follow these steps to let VS 2005 know where the user
defined templates are located.
1.
In VS 2005, go to Tools->Options.
2.
Expand Projects & Solutions.
3.
Click On General.
4.
Make the necessary changes in Visual Studio user Project Templates
location and Visual Studio user Item Templates location.
5.
By default, the options should be pointing to C:\Documents and
Settings\<User>\My Documents\Visual Studio 2005\Templates. This can be
changed to point to a network drive too.
Once the above
steps are followed on each of the developer's machine, the developers can
create a central repository of all the project templates to be used in the
organization. So, each time either a project or item template is created,
those templates can be pushed to this location. In the next few sections I
will explain how to create Project Templates and Item Templates.