Sunday, February 3, 2013

Merging ASP.NET Web Application projects with ASP.NET MVC Projects

If you want to learn how to merge an ASP.NET Web Application project with an ASP.NET MVC project, you can follow this article here: http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNet4WebFormsApplications.aspx

This might be useful if you start out with an ASP.NET Web Application project that you have built quite some time ago and have now decided you want to leverage the power and flexibility of ASP.NET MVC with Entity Framework and jQuery.

One of the notable things that is missing from Scott Hanselman's article is manually editing the Visual Studio project file in order to get the right click Visual Studio MVC functionality into the project.

You can accomplish this by doing the following:


  1. Simply open a valid ASP.NET MVC Web Application project file in Visual Studio
  2. Unload the project and right click and select it for Editing.  
  3. Right click and select Edit the .csproj file
  4. Review the ProjectTypeGuids element in the ASP.NET MVC Web Application Project and copy them to the clipboard
  5. Follow steps 1-3 for the ASP.NET Web Application project file and replace your existing ProjectTypeGuids
  6. Save the resultant ASP.NET Web Application project file.
  7. Reload the ASP.NET Web Application project
  8. Right click on the Controllers or Views directory in Visual Studio and verify that you now are able to add appropriate Controllers or Views to the respective directory!

No comments:

Post a Comment