What to do when Visual Studio templates are missing
I recently stumbled upon a problem where some Visual Studio templates wasn't available when I choose Add new item in Visual Studio.
I needed to generate some LINQ to SQL classes, but the Data alternative wasn't there.
After some searching, here's what solved the problem:
For Visual Studio 2010, find the VS command prompt (in the start menu), right click it and choose 'Run as administrator'. Execute this command:
You won't be noticed if anything succeeds or fails, but you should now have the appropriate Visual Studio templates available in the Add new item menu.
For Visual Studio 2008, I solved the problem by re-installing Visual Studio 2008 Service Pack 1.
Also, you can have a look in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates folder to see what's missing. You can even copy zip files from other Visual Studio installations to the folders here and execute the above command for Visual Studio 2010, and get it working.
Also - there's a difference when adding files in Solution Explorer, compared to through the File menu.
Here are some blog posts and stack overflow posts that helped me: