Plugging in your own templates to Create New Project and Add Item
I wanted to let you all in on a trick I've been using for creating my test projects.
If you open up VS 2005, a new menu item has snuck on to the File menu: "File->Export Template". If you're always adding in the same sets of files into your project and changing a whole bunch of text, there are two options for the kinds of templates you can create:
Project template: Plugs into the "Create New Project" dialog.
Item template: Plugs into the "Add New Item" dialog.
You can put in replacement parameters in your files to represent stuff that might change (like safeprojectname, GUID, machinename, etc).
When you want to share the templates, it's pretty easy. They wind up being .zip files that show up on the hard disk. In my case, I just took
C:\...\My Documents\Visual Studio 2005\My Exported Templates\WindowsApplication24.zip
And made sure that it was in
C:\...\My Documents\Visual Studio 2005\Templates\ProjectTemplates
If you want to have different versions for different languages, you can move the template in the "Templates" directory to "Visual Basic" or "C#", etc folders.
You can also keep the templates in a central location.
More information
The basics:
Instructions for exporting a template
How to share your templates with others
Tweaking your template:
More details on the different kinds of templates and what's inside
More details on the replacement parameters
What's allowed inside a .vstemplate file
Comments
- Anonymous
May 15, 2006
The comment has been removed - Anonymous
May 16, 2006
Unfortunately, the menu items and the help are the extent of my knowledge in the area.
The Visual Studio Extensibility MSDN forum looks like a great place to start digging deeper...
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=57&SiteID=1 - Anonymous
June 29, 2006
Yesterday I was working for my demos for CodeCamp Tampa (yep, I’m finally speaking somewher), and...