Monday, December 23, 2013

Upgrading ASP.NET MVC 4 projects to ASP.NET MVC 5

As you may know, ASP.NET MVC 5 support was released with Visual Studio 2013.  However, what if you have an ASP.NET MVC 4 project?  How do you go about upgrading to ASP.NET MVC 5?

Well, fortunately, the process of upgrading your ASP.NET MVC 4 project to ASP.NET MVC 5, though not completely automatic, is relatively simple.

First of all, you will need to upgrade the MVC assemblies in your project to ASP.NET MVC 5.  You can accomplish this through updating MVC in a NuGet package as shown in the screenshot below:

Once you have upgraded your MVC assemblies, you will have to do a bit of manual editing:

  1. You will have to edit both the Web.config file in the root of your Web project as well as within the Views folder.
  2. All references to System.Web.WebPages, System.Web.Helpers, and System.Web.WebPages.Razor will have to be updated to version
  3. All references to System.Web.Mvc have to be updated to version
If you now launch your MVC Web Application project and it launches without any Web.config error messages regarding incorrect assembly versions, you have successfully upgraded your project to ASP.NET MVC 5!!

No comments:

Post a Comment