Converting a ASP.NET MVC 3 Project to MVC 4
What steps should I take to safely upgrade an existing ASP.NET MVC 3 project to the latest ASP.NET MVC 4 Developer Preview?
Solution 1:
The major change is to upgrade the relevant references to the latest version (4.0 /2.0). You need to update your web config files to upgrade the version of the following namespaces
- System.Web.Mvc ( Change to 4.0.0.0)
- System.Web.Webpages (Change to 2.0.0.0)
- System.Web.Helpers (Change to 2.0.0.0)
- System.Web.WebPages.Razor (Change to 2.0.0.0)
Also you need to update the root level web config file to have these appsettings entries
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="PreserveLoginUrl" value="true" />
</appSettings>
Then you need to update the DLLs referenced in the project. Remove the existing MVC3 dll reference and add MVC4 (use nuget package manager to do this)
This link handles all aspects of the conversion. Refer it as needed.
Solution 2:
Follow the official steps posted here:
Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4
Note: These steps cover the official release--not the developer preview.
Solution 3:
Better yet, use the auto-update tool:
https://www.nuget.org/packages/UpgradeMvc3ToMvc4