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?

tereško
  • 58,060
  • 25
  • 98
  • 150
aruni
  • 2,664
  • 10
  • 44
  • 68
  • 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. – Finster Nov 21 '13 at 19:09
  • 2
    You need update your project to ASP.NET MVC 4 http://stackoverflow.com/questions/20063112/project-on-visual-studio-2012-be-open-on-visual-studio-2013-cannot-add-view-or-c/20184296#20184296 – HungND Nov 25 '13 at 03: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. – arserbin3 Jun 03 '14 at 23:16

8 Answers8

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.

user3705013
  • 306
  • 3
  • 2
  • This worked for me, but I had to restart VS before 'Add > Controller' appeared – Alex Jan 12 '15 at 10:57
  • 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. – Nick Feb 10 '15 at 13:15
  • 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). – Daan Mar 13 '15 at 16:03
  • 1
    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. – Youkko Apr 01 '15 at 14:55
  • Hey i am using visual studio 2015 professional but this is not working in this any other solution to add controller to context menu. – Jenish Zinzuvadiya Sep 10 '15 at 17:34
11

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

feradz
  • 1,312
  • 1
  • 16
  • 29
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.

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.

Dan
  • 11
  • 1
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.

Scott Blasingame
  • 1,821
  • 2
  • 15
  • 7
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

Community
  • 1
  • 1
Saber
  • 5,150
  • 4
  • 31
  • 43
  • I tried all the above solutions but none seemed to work as VS would reverse the guids back to the default value. – Saber Jun 11 '15 at 11:40
0

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

Saikh Rakif
  • 135
  • 3
-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