How do I get the Add Controller and Add View options in my ASP.NET MVC project?

I added ASP.NET MVC manually to an existing WebForms application ... thanks to this tutorial .

However, now I do not have the menu options (when I right-click on the Controllers folder or in the Views folders) to display the Add Controller or Add View dialog boxes. I have this when creating a new MVC project. How can I get a visual studio to understand that I am using MVC in this mixed project?

+3
asp.net-mvc
May 01 '09 at 2:08
source share
6 answers

Technically, controllers are only .CS files that are placed in the controllers folder, and views are only .ASPX files that are placed in the views folder. Controller classes must inherit from the base class Controller and your ASPX page must inherit from System.Web.Mvc.ViewPage.

As for getting these items in your menu, try opening the project file and replace the projecttypeguids tag with this one.

<ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> 
+10
May 01 '09 at 2:36 p.m.
source share

To fix your computer, go to http://www.microsoft.com/en-us/download/details.aspx?id=41532 and make sure that you install both ASP.NET and Web Tools 2013.1 for Visual Studio 2012 "and" ASP.NET and Web Platforms 2013.1 - Visual Studio 2012 ".

After installation, you should have both of them in the list of installed programs.

For more information, you can check this URL: 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 .

The type project GUID object is just a workaround. But it will be automatically uninstalled after installation.

+2
Oct 17 '14 at 12:44
source share

I had the same problem, except that I started working with the Asp.Net MVC project. I don’t know why this is happening. While I fully understand which controllers (Harv), I still want auto-generation, which offer context menu options. CS menus are not displayed in the solution explorer or in the document window when editing the controller file, according to Walther’s video, he simply right-clicks the Index method and he receives the cs menu option to create the view, Add View dialog box, , BTW, my design tips are identical to the ones you provided, so that didn't help.

Thanks Berlioz

+1
Dec 22 '09 at 16:46
source share

Do not update your version of the MVC project. Fire this command in the Nuget Package Manager console.

Microsoft.AspNet.Mvc Package Update

Restart the visual studio project.

And do not forget about it. To resolve this error

Trying the transparent security method 'WebMatrix.WebData.PreApplicationStartCode.Start ()'

Install-Package -Id Microsoft.AspNet.WebHelpers

0
Nov 05 '15 at 16:07
source share

I had this problem in Visual Studio Enterprise 2015 update1 and was resolved by installing the latest update.

0
Oct 28 '16 at 15:20
source share

ASP.NET MVC prefers a configuration convention, so there really is no other way than Harv's answer to set it up. To get these options, you must right-click the folder named “Controllers” and the folder “Views”.

-four
May 01 '09 at 15:54
source share



All Articles