Create Project Templates - Made easy in Visual Studio

Project Templates in Visual Studio make our life a lot easier, letting go our fear and repetitive work of developing same project containers for the very same purpose.

Visual Studio Orcas and its predecessor Visual Studio 2005 allowed the .net community 
just that. It’s easy to create a custom project template in visual studio and make
it available in the Project Templates Dialog with ease.

If you need to define a “Visual Studio Template”, you can say it is a collection of files
that are represented as a zip package (stored in a special folder) and are represented by an
icon, name and description in the Project template dialog. It can contain Program Stubs,
Assembly references, compiler options set to the project e.t.c.
Let’s say you want to create a Shell Project and make it available as a Project Template
the Visual Studio installed templates dialog. Let’s say that you need to distribute it
across to few other developers, or reuse it across applications, and then the following
technique will help you out. Also add some stuff like Splash Screen along with some
default styles add to the Shell. Create the solution as you would normally.
Once you have added the necessary code, necessary assembly references to the project,
and make sure it is compiling, we can create it as a Project template.
Lets say you have a solution structure as follows,

And say the is what I need to make redistributable in the form of a Project Template.
Choose the “Project Template” and the appropriate project (“”) In the screen that follows, choose an icon and a Name for the Project Template.
The Project Template would be saved to “My Documents\Visual Studio 2008\My Exported Templates” folder. The Project Template is saved as a “Zip” file along with the following files. 1. TemplateProject Icon 2. .VS Template file that contains the metadata information about the files.

From next time, whenever you do “Add new Project” you would find these project templates
under the “My Templates” section. The template file (.vstemplate) stores the metadata that is used to display the template in the Project Dialog.
By [)ia6l0 iii   Popularity  (1987 Views)