Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4
Updated on 03-Feb-2013
Check out this NuGet package for auto update MVC 3 to MVC 4 application and read this post for more info ASP.NET MVC: Auto upgrade MVC 3 to MVC 4 application
This post is part of ASP .NET MVC 4 Article Series.
To upgrade and existing ASP.NET MVC 3 Project to ASP.NET MVC 4, one need to take care of following points. Complete guideline on upgrading from MVC 3 to MVC 4 is available in MVC 4 Release Notes.
- In all web.config, including one in root folder and Views folder, change assembly version 3.0.0.0 to 4.0.0.0 for System.Web.Mvc and 1.0.0.0 to 2.0.0.0 for System.Web.WebPages, System.Web.Helpers, System.Web.WebPages.Razor.
- Change appSettings value for key "webPages:Version" to "2.0.0.0". Apart from that also add new appSettings key named "PreserveLoginUrl" with "true" as a value.
- Now remove all reference to MVC 3.0 assembly and Webpages 1.0 assembly. And add a reference to MVC 4.0 assembly and Webpages 2.0 assembly.
- If you are using any third party assembly built with previous versions of MVC then do not forget to configure bindingredirect in root web.config as mentioned here.
- Finally one more step is to change project type to MVC 4 from MVC 3. For that unload project by right clicking in solution explorer and select edit ProjectName.csproj file. Now Locate the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}. Now save changes and re load the project.
Complete step by step information is given here in MVC 4 Release Notes.