visual studio 2013 'add controller' missin

2020-02-06 05:04发布

问题:

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.

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?

回答1:

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.



回答2:

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.



回答3:

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.



回答4:

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.



回答5:

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.



回答6:

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



回答7:

nothing is to be done only Add=>scafolding=>MvC5



回答8:

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