Visual Studio 2010: Add New Item to Project Issue

by Aaron 23. January 2011 04:56

A couple of weeks ago, we got an email from one of the developers on our project who happened to be working off-site for the day.  It said:

Are any of you able to add a class to Fake.Project.Name?  The dialog
has no installed templates listed when I try.

Of course I thought it was user error until I tried it myself.  This is what I saw:

Add new item - empty template list

Notice that it's an empty list.  I tried another project and got a dialog that actually had what I was looking for:

Add new item - correct list

I did some work with Great Migrations, so I learned a bit about what makes up a project file to tell Visual Studio what is the project type, the language, etc.  It's all very Microsoft-oriented GUID-oriented, much like SharePoint and TFS.  So I suspected that the project file had gotten corrupted somehow with a bad GUID or a GUID that was removed.

The odd thing is that the projects were originally created in Visual Studio 2008 using C# for .NET 3.5.  They were upgraded for Visual Studio 2010 using the upgrade wizard.  Nothing about the project was hand-edited.  Regardless, I did a comparison of the project files to see what the differences were, paying close attention to anything that defines the type of project and language.  This is the first thing that caught my eye:

It's a minor thing, but the offending project (bottom pane) has a GUID in the ProjectTypeGuids node in lowercase, while the working project has it in uppercase.  Starting with a simple solution, I changed the GUID in question to be all uppercase.  Success!

While I can't be certain, it appears that it's doing a case-sensitive string lookup on the ProjectTypeGuids, or at least that one.

If you encounter an issue like this, checking and comparing the GUIDs in your project file is quick and easy.

Tags: , , , , , , ,