Context menu to Add Controller/View missing

asp.netasp.net MvcVisual StudioVisual Studio-2010asp.net Mvc-4

asp.net Problem Overview


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?

asp.net Solutions


Solution 1 - asp.net

> Are those only available to ASP.NET MVC template?

Yes, but you could cheat. The way Visual Studio shows those shortcuts is by looking at the project type and if it sees that it is an ASP.NET MVC project it will make them available. But how does it know it is an ASP.NET MVC project? After all ASP.NET MVC is an ASP.NET project.

Open the .csproj file and look for the <ProjectTypeGuids> node of your ASP.NET MVC 4 project. You will see something like this:

<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

Now open the .csproj file of your regular ASP.NET project and simply add the {E3E379DF-F4C6-4180-9B81-6769533ABE47} GUID as first item in the list (if you don't project does not even load). That's all. Now you will see the ASP.NET MVC specific context menus in your WebForms project.

Solution 2 - asp.net

Step to change the GUID

  1. Right click on the project in solution explorer
  2. Click unload project
  3. Right click again on the project in solution explorer
  4. Edit projectfolder/projectname.csproj
  5. Chagne GUID
  6. Right click and select "Reload Project"

In <ProjectTypeGuids> tag add any of these GUIDs in beginning

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

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

Solution 3 - asp.net

For people using MVC 5, add this key

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

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

Solution 4 - asp.net

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

> Update-Package Microsoft.AspNet.Mvc

Solution 5 - asp.net

Answer 2 was correct just wrong guid

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

is what you need for MVC in VS2010

Solution 6 - asp.net

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}

Solution 7 - asp.net

I had the same problem when opened MVC project as Web Site. I reopened solution thru Open -> Project and this functionality worked as I expected.

Solution 8 - asp.net

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

Solution 9 - asp.net

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

Solution 10 - asp.net

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

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

Solution 11 - asp.net

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][1]

I found this download link from the following blog post:

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

[1]: http://www.microsoft.com/en-us/download/details.aspx?id=41532 "ASP.NET and Web Tools 2013.1 for Visual Studio 2012" [2]: http://blogs.msdn.com/b/webdev/archive/2013/11/18/announcing-release-of-asp-net-and-web-tools-2013-1-for-visual-studio-2012.aspx "Announcing release of ASP.NET and Web Tools 2013.1 for Visual Studio 2012"

Solution 12 - asp.net

You are correct. The presence of these context menu options is project type/template specific.

Solution 13 - asp.net

For older version

{F85E285D-A4E0-4152-9332-AB1D724D3325}

Solution 14 - asp.net

When all else fails (before reinstalling VS2015) you might want to reset VS cache. This worked for me (after repairing - NOT meddling with GUIDS). Just delete the contents in the folders mentioned in this link (takes about 30 seconds), then execute the command. That takes another 10 seconds. Restart VS and you will see the screens of a first-time user in VS. It worked like a charm.

http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not.aspx

Solution 15 - asp.net

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.

Solution 16 - asp.net

Here's what worked for me with VS 2017.

First check if you're able to create a new empty MVC project.

If not - this means some components are missing. Launch Visual Studio Installer (typicall sits in C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe but you cna just hit "start" and start typing "visual studio installer")

Lick "modify" and simply re-run it with all existing components checked.

Just make sure "ASP.NET Web development" is checked.

Solution 17 - asp.net

You might have opened the project as folder type which limits the visual studio IDE to limit certain GUID options, so load your project solution.

It should work. Add view or Add controller should be available as soon as you right click on the ActionResult or inside controller.

Solution 18 - asp.net

VS2012 Context menu to Add Controller/View missing

In VS2012 & MVC4 try unistall Web API 5.2 in PM:

UnInstall-Package Microsoft.AspNet.WebApi 

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser1186065View Question on Stackoverflow
Solution 1 - asp.netDarin DimitrovView Answer on Stackoverflow
Solution 2 - asp.netAli AdraviView Answer on Stackoverflow
Solution 3 - asp.netBjorn VdkerckhoveView Answer on Stackoverflow
Solution 4 - asp.netJenish ZinzuvadiyaView Answer on Stackoverflow
Solution 5 - asp.netDonView Answer on Stackoverflow
Solution 6 - asp.netpapadooView Answer on Stackoverflow
Solution 7 - asp.netdragyView Answer on Stackoverflow
Solution 8 - asp.netDillonView Answer on Stackoverflow
Solution 9 - asp.nett_plusplusView Answer on Stackoverflow
Solution 10 - asp.netAlex NarbutView Answer on Stackoverflow
Solution 11 - asp.netMike StrotherView Answer on Stackoverflow
Solution 12 - asp.netNathan TaylorView Answer on Stackoverflow
Solution 13 - asp.netisxakerView Answer on Stackoverflow
Solution 14 - asp.netJoe KehnastView Answer on Stackoverflow
Solution 15 - asp.netTheophilusView Answer on Stackoverflow
Solution 16 - asp.netAlex from JitbitView Answer on Stackoverflow
Solution 17 - asp.netsreeni vasanView Answer on Stackoverflow
Solution 18 - asp.netuser2825149View Answer on Stackoverflow