There are so many features to VS2008 that a beginner might feel overwhelmed and stick to those features that they already know and love. Sticking to what you know is important, but searching and learning might result in productivity gains that’ll keep you ahead. Despite working with VS for some time, I always have the feeling that features that I miss are in there hidden somewhere in those numerous menus.
The discovery of custom templates was a pleasant surprise and further harnessed my curiosity in the other features in this IDE that I was missing out on.
For now, however, let’s stick to the Templates and how they might help you make Visual Studio a more friendly environment.
To understand the benefit we first have to understand the problem.
Problem: Inserting a new project into a solution or a new item into a project may result in a series of repeated tasks that are time consuming and tedious. Sometimes the issue is even greater than the time taken but the lack of automation may result in items and projects with different configurations and a lack of standard.
Real-Life Situation: In my workplace, we have two customized windows forms called RecordBase and FormBase. Virtually every window in our solutions inherit from these two winforms. As simple as it may seem to go into the Designer file and changing the Inherits statement, some people believe very strongly that you shouldn’t mess with the designer file and end up commenting the Inherits in that file and including the Inherits statement in the VB file.
Creating a template is as easy as doing what you’ve done a thousand times -inserting a project or an item and customizing it to your needs- and following a wizard.
So, to create a template for the afore mentioned real-life situation you would do the following:
1. Insert the item to the project and customize it as you would. In my case, switch the inherits in the designer file to a custom inherits.
2. Go to File – > Export Template

Choose the type of template you want to create and from which project.
3.

If you've chosen an Item Template, you'll select the item that you want to create a template for in this screen.
4.

If you've chosen the Item Template, you can choose references that need to be included whenever this specific Item is inserted.
5.

Last but not least, you'll include a name for the template, an Icon and a simple description.
6. THAT’S IT! I bet you didn’t think that it would be so simple am I right?
Extra tip: If you want to share the templates you created, just go into the following directory:
\My Documents\Visual Studio 2008\Templates\
Copy the zip files and send them to your colleagues. Once they’ve stored the files in the same location above, VS2008 will do the rest and automatically import the templates.