21

I've updated a default template in Visual Studio 2008 with the following path:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\Web\CSharp\1033

But when I've tried adding a new file with this type of template, I'm still getting the old version which I have found to be cached in this folder path:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\Web\CSharp\1033

What I would like to know is when does a new project template get pulled from it's zip file and put into the Item Tempate Cache in visual studio?

Chris
  • 6,272
  • 9
  • 35
  • 57

4 Answers4

35

Open up the Visual Studio Command Prompt and type in:

devenv /installvstemplates

Source: How to Edit Visual Studio Templates

Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
  • 2
    Will Visual Studio do this automatically at sometime or is this always something that needs to be done manually. – Chris Nov 11 '09 at 19:50
  • 1
    I also had to run this statement: devenv /resetsettings – Daryl Jul 09 '11 at 00:02
  • 13
    Note that you must run this with elevated privileges. – nicodemus13 Nov 21 '11 at 18:12
  • 2
    /resetsettings was not necessary for me. Just the elevation. Also note that it can take a while to run, so open taskman and make sure that devenv is done and exited before trying to use the new templates. – scobi Apr 20 '12 at 16:47
10

Launch "Developer Command Prompt for VS 2022" as Administrator

devenv /updateconfiguration

See: https://developercommunity.visualstudio.com/t/cannot-remove-item-template/27424

/installvstemplates did not work me in VS 2022.

testalino
  • 5,474
  • 6
  • 36
  • 48
  • ~~Somehow this did nothing to me but created an empty folder `%USERPROFILE%\Documents\Visual Studio 2022`. I had empty templates upon fresh install of 17.5.0 :( I had to copy templates manually as in https://stackoverflow.com/a/46895353/673826 ~~ Now I'm confused as I see new project templates with just empty folder in my documents. – mlt Feb 28 '23 at 00:05
  • It's incredibly confusing. When you use the "Export Template" function in Visual Studio, it by default goes into `%USERPROFILE%\Documents\Visual Studio 2022\My Exported Templates`. If you check the box that says "Import Into Visual Studio" it puts a copy somewhere in `%USERPROFILE%\Documents\Visual Studio 2022\Templates`. But it maintains a cache of all those templates in yet another place, which is why we have to run this `devenv /updateconfiguration` command, to update it if you make a manual change to a template. That's my understanding at this point, anyway. – Matt Gregory Jun 27 '23 at 01:31
3

I had the same issue. What was here did not work for me. What I did however is to go to a specific folder and edit the files directly. Just go there :

%AppData%\Microsoft\VisualStudio\{some_version}\ItemTemplatesCache\

It contains folders named after the zip files from your archives in the template folder. I needed admin priviledge for edits.

Enjoy.

UchiTesting
  • 111
  • 8
0

I encountered a similar issue, and what worked for me was the following:

Once I placed the new or updated zip files in the ProjectTemplates folder, I reexported the template of a project. During this process, I made sure to check the "Automatically import the template into Visual Studio" option. After doing this, my VS2022 detected and included all the new and updated templates from the ProjectTemplates folder.