views:

4322

answers:

2

I have created an Item Template using the "Export Template" wizard. I opened up the XML file and made a couple of minor changes, then rezipped the package. Then I checked the item template into source control so that everyone on the team can access it if they want.

But for the life of me I can't get the template to show up under My Templates when I go to Add->New Item.

I have tried copying the zip file into every conceivable directory:

  • The template directories listed under Tools->Projects and Solutions->General
  • All the subfolders of these directories (i.e. /Visual C#/, /Visual Web Developer/ etc)

But nothing shows up. Has anyone else managed to distribute Item Templates to their team mates before?

A: 

Here are the two articles I found online:

First the one on how to create an item template:

http://msdn.microsoft.com/en-us/library/ms247113(VS.80).aspx

Second is how to get VS to locate the item template.

http://msdn.microsoft.com/en-us/library/y3kkate1(VS.80).aspx

As far as I can see you have to place your custom templates in:

My Documents\Visual Studio 2005\Templates\ProjectTemplates\Language\

Adam Berent

Adam Berent
+9  A: 

In order to have a VS item template appear, you need to make sure that you run "devenv.exe /installvstemplates" after you have copied the .zip file containing your .vstemplate and template code file into the %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\<Project Type> folder.

I've found that it's useful to wrap the whole thing up into an MSI that discovers the VS9 path, copies the Item/Project template to the necessary folder, and calls a custom action that shells out to devenv.exe passing the "/installvstemplates" switch. That way your colleagues just need to install the package and they are up and running!

Hope this helps.

Andy Hopper
Cool thanks - wow all that documentation out there is SOOO wrong
cbp
I just tried this and it not only failed to install my custom template, it deleted all the built-in ones too.
DanM
Okay, I tried the command a few more times, and now they're all back again. Momentary panic :)
DanM