Tuesday, August 9, 2011

Add Controller Menu Missing From VS2010 Context Menu

Normally in VS2010, when you right-click on the ‘Controllers’ folder, you will get a menu that includes 'Add/Controller’.  If this menu option is gone, it is because the project type is not setup correctly. 

To fix this:

  • Create a new blank MVC project.  Save and close the project.
  • Open up the csproj file in Notepad.
  • Copy the <ProjectTypeGuids> attribute.
  • Open up the csproj file you want to fix. 
  • Replace the <ProjectTypeGuids> attribute with the one you copied from the other file.