Did you know… You can create project templates? - #336
Starting in Visual Studio 2005, you can create your own custom project templates to appear alongside the VS-installed project templates.
First, you’ll want to create a new project and set it up exactly like you want it to appear when you do File – New – Project – <ProjectTemplate>. In the example below, I created a VB Console Application using two references and some placeholder function calls and comments in the one file.
You can go to File – Export Template to bring up the Export Templates wizard. Since this is about Project Template, keep the default Project option selected. If you have multiple projects in your solution, you can select which one to use from the combo box drop down.
On the next page, you change the default options for your project, which I’ll go over into detail over the next week.
Some basics before we leave here today:
- The project templates you create will be saved in Documents\Visual Studio 2008\My Exported Templates
- The template is just a .zip file that contains the associated files with your project and the <filename>.vstemplate file (a .xml file) representing any metadata and how the files should be coordinated
And, if you use the exact defaults, the result is your project template in the New Project Dialog under the root folder for that language:
but more customization tips to follow!
Technorati Tags: VS2005Tip,VS2008Tip
Comments
Anonymous
October 16, 2008
Hey Sara, I've been following to your blog for quite sometime now and definitely it has helped me discover lots of new things. Thanks for such wonderful posts. But, I'm not able find some of the features that you mention in these post, like this one, in Visual Studio 2005 Professional edition that I use. Are these specific to specific version of Visual Studio? Thanks, Dina.Anonymous
October 17, 2008
Duh. I didn't know you could export it. I was manually adding this to my template directory and zipping it.Anonymous
October 17, 2008
And to think I only found this out two days ago... it's one of my little timesavers, though the setup time is minimal at best for the single project I created as a template, I think I did okay. What do you mean by tailoring the template placeholders? I'm pretty new to Visual Basic of any flavour.Anonymous
October 27, 2008
Thanks for all your helpful tips! Do you have any guidance for creating a project template based on the Web Setup project?Anonymous
November 08, 2008
hi sara. can i create a template solution, containing more then 1 project?Anonymous
December 26, 2008
One of the most time consuming things to do when starting a new web project is setting up the sites directory