Context menu to Add Controller/View missing

2019-01-06 11:01发布

I have integrated ASP.NET MVC 4 into existing asp.net web site. Both works fine but I don't see any menu/shortcuts to create controller/view within visual studio IDE. Are those only available to ASP.NET MVC template?

16条回答
兄弟一词,经得起流年.
2楼-- · 2019-01-06 11:49

Had the same problem with VS2015, helped changing ProjectTypeGuids content to:

{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
查看更多
唯我独甜
3楼-- · 2019-01-06 11:50

For me it was missing from where I expected it to exist (at the top of the menu which shows when you right click on a view folder and click on 'Add'), but then I found it at a sub context menu under 'New From Template'! I have re-sharper installed, I guess it happened because of it (Also Visual Studio 2012):

enter image description here

查看更多
ら.Afraid
4楼-- · 2019-01-06 11:51

I know this is an old post, but I just ran into this switching between VS2013 and VS2012 for an MVC 5 Project. The issue I had is that the version of the MVC Template I was using wasn't installed from the Visual Studio update. VS2012 didn't come with MVC5 as it came out after it, so an update was required for VS2012 to add the template. Same with VS2010 and MVC4 I imagine.

Anyhow, downloading the update from Microsoft resolved my issue as when another version opened and saved the project, it would again disappear when using the fix above.

Here is the link to the VS2012 MVC5 update. Ensure that you download and install both the Tools update and the VS plugin.

http://www.microsoft.com/en-us/download/details.aspx?id=41532

查看更多
Lonely孤独者°
5楼-- · 2019-01-06 11:51

This problem can also occur when you have just checked out a fresh copy of your solution from your code repository and the NuGet packages, including Microsoft.AspNet.Mvc, have not yet been downloaded. Rebuilding the solution fixes the problem.

查看更多
登录 后发表回答