Context menu to Add Controller/View missing

68,874

Solution 1

Are those only available to ASP.NET MVC template?

Yes, but you could cheat. The way Visual Studio shows those shortcuts is by looking at the project type and if it sees that it is an ASP.NET MVC project it will make them available. But how does it know it is an ASP.NET MVC project? After all ASP.NET MVC is an ASP.NET project.

Open the .csproj file and look for the <ProjectTypeGuids> node of your ASP.NET MVC 4 project. You will see something like this:

<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

Now open the .csproj file of your regular ASP.NET project and simply add the {E3E379DF-F4C6-4180-9B81-6769533ABE47} GUID as first item in the list (if you don't project does not even load). That's all. Now you will see the ASP.NET MVC specific context menus in your WebForms project.

Solution 2

Step to change the GUID

  1. Right click on the project in solution explorer
  2. Click unload project
  3. Right click again on the project in solution explorer
  4. Edit projectfolder/projectname.csproj
  5. Chagne GUID
  6. Right click and select "Reload Project"

In <ProjectTypeGuids> tag add any of these GUIDs in beginning

{E3E379DF-F4C6-4180-9B81-6769533ABE47};

{E53F8FEA-EAE0-44A6-8774-FFD645390401};

Solution 3

For people using MVC 5, add this key

{E3E379DF-F4C6-4180-9B81-6769533ABE47}; 

in the beginning of . The other guids won't work.

Solution 4

Do nothing just update your MVC project. Fire this command in your Nuget Package Manager console.

Update-Package Microsoft.AspNet.Mvc

Solution 5

Answer 2 was correct just wrong guid

{E53F8FEA-EAE0-44A6-8774-FFD645390401}

is what you need for MVC in VS2010

Share:
68,874
user1186065
Author by

user1186065

Updated on July 28, 2021

Comments

  • user1186065
    user1186065 almost 3 years

    I have integrated ASP.NET MVC 4 into existing asp.net web site. Both works fine but I don't see any menu/shortcuts to create controller/view within visual studio IDE. Are those only available to ASP.NET MVC template?