Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

asp.net-mvc

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 right-clicking on the Controllers folder or Views folders) to show the Add Controller or Add View dialog boxes. I do have this when creating a brand new MVC project. How can I get visual studio to realize I am using MVC in this mixed project?

like image 299
BigJoe714 Avatar asked Sep 10 '25 17:09

BigJoe714


1 Answers

Technically controllers are just .CS files that are put in the controllers folder and views are just .ASPX files that are put in the views folder. Your controllers classes need to inherit from the base Controller class and your ASPX page needs to inherit from System.Web.Mvc.ViewPage.

As far as getting those items in your menu though try opening your project file and replacing the projecttypeguids tag with this one.

<ProjectTypeGuids>{603c0e0b-db56-11dc-be95-000d561079b0};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
like image 135
Harv Avatar answered Sep 13 '25 08:09

Harv