Add controller option removed after upgrading MVC4 to MVC5 [duplicate]

99封情书 提交于 2019-12-10 17:47:04

问题


I have started a new basic Razor website, as a sort of 'clean slate' for the update.

I followed the tutorial that everyone recommends, and it had completed without an issue.

Unfortunately, now, I have no option to add a controller.
When I right click on the Controllers folder and move to add, there is no Controller option. There is also no Controller option in add>new item or add>from template.

Can anyone please help me get this functionality back? I've been browsing for solutions for a while now, and mine seems pretty unique.


回答1:


Install the following items:

  1. Visual Studio 2012 Update 4
  2. Web Tools 2013.1 for Visual Studio 2012 (Web Platform Installer | Direct Download)

Then follow this tutorial to upgrade your MVC 4 project to MVC 5.

Finally make sure your project has the following ProjectTypeGuids:

 <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

In MVC5 the option you're looking for might be hidden under the Add Scaffold menu option. See the release blog post for more information on MVC5 scaffolding.



来源:https://stackoverflow.com/questions/20396195/add-controller-option-removed-after-upgrading-mvc4-to-mvc5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!