Fix Visual Studio when templates disappear from your Add New Item dialogue

So, I was trying to add a new class to a project in Visual Studio and the template for it seemed to have disappeared.

I still had the “Add Class” option in the dropdown but no “Class” option when I got into the “Add New Item” dialogue.

Luckily, it’s pretty easy to fix.

Find the templates

If you have a look inside your VS installation folder <VisualStudioInstallDir>\Common7\IDE\, you’ll see these folders:

  • ItemTemplates
  • ItemTemplatesCache
  • ProjectTemplates
  • ProjectTemplatesCache

The two templates folders contain the zipped up sources for the item templates you use inside Visual Studio. The cache folders contain the unpacked versions.

If templates are missing from Visual Studio, something’s probably gone wrong with your cache.

Clear your caches

Close down Visual Studio and delete the two cache folders ItemTemplatesCache and ProjectTemplatesCache (or back them up if you don’t want to throw caution to the wind).

Now open up an elevated command prompt (run as administrator) and navigate to that same directory. On my system, that’s:

cd C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE

You can use the devenv.exe to reinstall your templates. So, run this:

devenv.exe /InstallVSTemplates

It should only take a second and nothing obvious will happen. Don’t worry, that’s what it’s supposed to do.

Check it worked

Now open up Visual Studio and you should see your two cache folders being recreated. Your templates should now be available to use.

Kevin Wilson

.NET developer, JavaScript enthusiast, Android user, Pebble wearer, sometime musician and occasional cook.

2 thoughts on “Fix Visual Studio when templates disappear from your Add New Item dialogue

  1. Thanx buddy….its worked for me and i was having exact same scenario that Class template stopped appearing.

    Anyways, now its working after this trick.

Leave a Reply

Your email address will not be published. Required fields are marked *