Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008: How to install an item template

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?

like image 462
cbp Avatar asked Apr 15 '09 01:04

cbp


People also ask

How do I add a template to Visual Studio?

The default location is %USERPROFILE%\Documents\Visual Studio <version>\Templates\ItemTemplates. Close Visual Studio and then reopen it. Create a new project, or open an existing project, and then choose Project > Add New Item or press Ctrl+Shift+A. The item template appears in the Add New Item dialog box.

Where do I put Visual Studio templates?

By default, user templates are located in: %USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates. %USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates.

How do I add a template to Visual Studio 2010?

To do so: Open Visual Studio IDE>>Tools>>Options>>Projects and Solutions>>General>>Change “User project templates location” to My Templates folder. You also can export settings of Visual Studio on first server via Tools>>Import and Export Settings…>> Export selected environment settings.


1 Answers

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.

like image 54
Andy Hopper Avatar answered Oct 26 '22 07:10

Andy Hopper