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:38

For older version

{F85E285D-A4E0-4152-9332-AB1D724D3325}
查看更多
Deceive 欺骗
3楼-- · 2019-01-06 11:40

By right clicking the project in Solution Explorer, you need to unload the project, edit the project, change the tag using the chart below, and then reload the project. Paste the appropriate GUID to the front of the list in the csproj file.

The different GUIDs for different versions of MVC:

ASP.NET MVC 1   {603C0E0B-DB56-11DC-BE95-000D561079B0}
ASP.NET MVC 2   {F85E285D-A4E0-4152-9332-AB1D724D3325}
ASP.NET MVC 3   {E53F8FEA-EAE0-44A6-8774-FFD645390401}
ASP.NET MVC 4   {E3E379DF-F4C6-4180-9B81-6769533ABE47}
ASP.NET MVC 5   {349C5851-65DF-11DA-9384-00065B846F21}
查看更多
老娘就宠你
4楼-- · 2019-01-06 11:43

For people using MVC 5, add this key

{E3E379DF-F4C6-4180-9B81-6769533ABE47}; 

in the beginning of . The other guids won't work.

查看更多
Luminary・发光体
5楼-- · 2019-01-06 11:43

I am on VS2012 and tried Dimitrov's answer (adding a particular GUID to the project file's ProjectTypeGuids). While this did give me the missing context menu for the controller actions, I was missing intellisense on my Razor pages.

It turns out I was missing the VS tooling for the version of the MVC project I was working on, and installing this tooling (rather than editing the project file) resolved my issues.

Download page for ASP.NET and Web Tools 2013.1 for Visual Studio 2012

I found this download link from the following blog post:

Announcing release of ASP.NET and Web Tools 2013.1 for Visual Studio 2012

查看更多
甜甜的少女心
6楼-- · 2019-01-06 11:47

Do nothing just update your MVC project. Fire this command in your Nuget Package Manager console.

Update-Package Microsoft.AspNet.Mvc

查看更多
一纸荒年 Trace。
7楼-- · 2019-01-06 11:49

Answer 2 was correct just wrong guid

{E53F8FEA-EAE0-44A6-8774-FFD645390401}

is what you need for MVC in VS2010

查看更多
登录 后发表回答