tags:

views:

137

answers:

3

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?

+6  A: 

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>
Harv
works great! Thank you.
BigJoe714
A: 

ASP.NET MVC prefers convention over configuration so there's really no way other than Harv's answer to be able to set it up. You have to right-click a folder named Controllers and a folder named Views to get those options.

Chad Moran
A: 

I got this same problem, except I started off cleanly with an Asp.Net MVC project. Don't know why this is happening. While I realize full well what controllers are(Harv) I still desire the auto-generation that the context-senstive menu options offer. CS menu's are not appearing in Solution Explorer or in the document window when editing the controller file, according to Walther video, he simply right-clicks on the Index method and he gets a cs menu option to create a view, an Add View dialog window. Oh BTW, my project guids are identical to the ones you provided, so that didn't help.

Thanks, Berlioz

Berlioz