22

I update the visual studio 2010 project to visual studio 2013. Then I want to ad a new controller. but there is no add Controller option.

enter image description here

But If I create a new project in 2013 it already have the add Controller option. So how to add the new Controller? something missing in web.config or missing reference?

3
  • From what I've read, you should be able to add a scaffolded item to any web project. Not sure why this is happening, as we see it, too. Commented Nov 21, 2013 at 19:09
  • 2
    You need update your project to ASP.NET MVC 4 stackoverflow.com/questions/20063112/… Commented Nov 25, 2013 at 3:39
  • 1
    This may sound dumb, but also make sure the project is not currently running in Debugger mode. Those Add Controller / Add View buttons disappear when debugging. Commented Jun 3, 2014 at 23:16

8 Answers 8

29

Make sure your .proj file includes all the appropriate project type Guids.

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

The first GUID allows all standard MVC operations in the context menus.

Sign up to request clarification or add additional context in comments.

5 Comments

This worked for me, but I had to restart VS before 'Add > Controller' appeared
This did not work for me, I closed VS, edited the .csproj file to include the E3E3... guid which was missing, saved the .csproj file, and loaded the solution in VS. Visual Studio reverted my changes, so the E3E3... guid was removed and back to square one.
This worked for me. However, this is not absolutely required for the project. After adding this, the option remains there (even after removal of the ProjectTypeGuids afterwards).
Didn't work for me. I unloaded the project, edited the .csproj file, added E3E3.. guid, and when i reloaded, got an error: not implemented. Then I tried to edit the csproj file again, removed and re-added E3E3, but now VS just reverts all changes in csproj file when i reload it.
Hey i am using visual studio 2015 professional but this is not working in this any other solution to add controller to context menu.
12

In my case Unloding and Reloading the project solved the problem. To unload - right click on the project name and choose "Unload Project" from the context menu. Then again right click on the project name and select "Reload Project" from the context menu.

enter image description here

enter image description here

2 Comments

Up+ , this solution worked for me while i miss "add view" option
This worked for me. I also re-installed MVC5 via NuGet, not sure if that helped.
1

Include Microsoft.ASP.NET MVC from Nuget Package in your project, you should be able to see the Add View menu when you right inside a method of controller class.

Comments

1

I was working with projects from a tutorial series. Tried addinging controller would lock up VS2013 for a few seconds but i couldnt add anything. no context menu would popup. I first needed to go into nuget package manager and update that. not sure if it's a missing GUID or some assembly but that fixed the issue.

Comments

1

I had problem with Add View and Add->Controller not showing up. My project type GUIDs were fine. What worked for me was uninstalling MVC and then reinstalling thru NuGet.

Comments

0

Combining the answers given at Reinstall Microsoft Visual Studio Asp.net MVC 5 Scaffolding extension

somebody came up with a solution which worked

http://awesomebitsnbytes.blogspot.com/2015/01/aspnet-mvc-menus-missing-add-controller.html

1 Comment

I tried all the above solutions but none seemed to work as VS would reverse the guids back to the default value.
0

nothing is to be done only Add=>scafolding=>MvC5enter image description here

Comments

-3

from the img you upload the Project you create is not the ASP.NET MVC Project Maybe try create a ASP.NET MVC Project will find it

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.