Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Legacy ASP.NET Application to MVC3 and HTML5

I have an ASP.NET application which works just fine, but which is becoming unwieldy. I would like to incorporate MVC3 functionality in it for any new pages, and gradually convert all the old pages. I plan to use the Razor syntax.

I've got it working. I can serve up pages just fine. It was a bit of a battle, but things looked good. I believe I have all the directory structure and the referenced DLLs.

My only real problems are with the IDE:

I cannot select "Add Controller.." when I right-click on the Controllers folder. Ditto for Views, and "Add Area..." from the project right-click menu.

I cannot add template items related to MVC3 (or MVC2, which I also have installed).

I also cannot validate HTML5 (all tags are invalid), but I think this is a separate issue, because this functionality doesn't work on my MVC3 projects either.

I would not even know that these things were missing if it didn't work perfectly for a project created as an MVC3 project (with Razor syntax), so it must be something specific in the solution or the project, but I cannot find it anywhere.

My question: Where do I change this so that the IDE acknowledges it as an MVC project?

like image 741
Jonathan Avatar asked Aug 03 '12 14:08

Jonathan


1 Answers

The reason why the menus are not coming is visual studio IDE do not consider this as a real ASP.NET MVC project because the project file does not say so. So we should update the project file to include the project type guid for ASP.NET MVC and then the IDE willl start supporting the menus specific for ASP.NET MVC type project.

Step 1

Go to your solution explorer and unload the existing ASP.NET project by right clicking and selecting “Unload Project”

enter image description here

Step 2

Right Click the Project in solution explorer and select “Edit your project file name“

enter image description here

Step 3

Add the below entry to it inside the ProjectTypeGuids section

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

enter image description here

Save. Reload the Project and you will be good now.

I clearly explained it here in a blog post.

like image 176
Shyju Avatar answered Nov 02 '22 17:11

Shyju