问题
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:
- Visual Studio 2012 Update 4
- 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