Did you know… How to use Project Templates

What are Project Templates

Project templates are sample projects you can use to create new projects, ie Windows Applications, Class libraries, Websites, and so forth.  For Whidbey, templates are stored on disk as a single zip file (no longer multiple files in multiple locations).  The VS Installed Templates are stored at Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates and \ItemTemplates.

User templates, the ones you and I create, are found by default under My Documents\Visual Studio 2005\Templates.  If you want to add a user-created template to the VS Installed Templates list, you’ll need to 1. copy the template to the default location for templates for the given language and 2. run the devenv /installvstemplates switch.

Whidbey also supports multi-project templates.  I’m going to turn you over to Craig’s blog that goes into more details about this. 
https://blogs.msdn.com/craigskibo/archive/2004/10/08/240134.aspx

How to create user templates

The easiest way is to just use the Export Template wizard.  First, create a class library project and let’s add an icon to the project.  Now go to File – Export Template.  The wizard first asks whether you want to create a Project Template or an Item Template.  It also asks which project to use as your basis for creating either.  Next page we get to customize our project template, so I’m going to call mine “SaraProject” w/ “This project was created by SaraF” for the description – exciting I know.  There’s an option whether to immediately import your template into VS (ie, copy the template from My Documents\Visual Studio 2005\My Exported Templates to My Documents\Visual Studio 2005\Templates\Project Templates automatically), and the other option is to see what was created in Window Explorer upon pressing Finish.

What’s inside the .vstemplate

No real surprises here – just the files associated with the project and an xml file (.vstemplate) needed to define the characteristic of your project. 

The xml file contains things like the name of the template, the description, whether to provide your own default name for your project like “MySaraFProject” (and whether you’re like VC and you have to provide a specific name, no lazy naming), and its sort order in the list.  The second section refers to where additional files.

Happy Visual Studio’ing!