Upgrade Application from Asp.Net MVC2 to MVC3
It’s been a much long after MVC3 is been released & now it is much stable. So while working on a project, I need to upgrade my ASP.Net MVC 2 project to MVC 3.
ASP.Net MVC 3 can be installed side by side ASP.Net MVC 2 on you PC, which gives you flexibility in choosing when to upgrade an MVC2 application to MVC3. It is been very easy to upgrade the project to MVC3. We just need to follow following steps
- Remove all references of System.Web.Mvc from each project in solution.
- Now add a reference for System.Web.Mvc 3.0 to each of the project in the solution.
- Also add a reference of System.Web.Helpers 2.0 to web project.
- Also add a reference of System.Web.WebPages 2.0 to web project.
- Go to views folder & open the Web.Config file & replace Version = 188.8.131.52 with version 184.108.40.206
- Also add following code to this Web.Config
- Open the root Web.Config file & replace all references of “System.Web.Mvc 220.127.116.11” with “System.Web.Mvc 18.104.22.168”.
- Now in appSettings add following keys
- Now we need to make sure our system.web->pages->namespaces tag contains following entries
- In the system.web->compilation->assemblies we should have following entries
- Finally under the configuration -> runtime section put following code
Also there is a tool available to upgrade the MVC2 to MVC3. Here is a link to the tool
You can find the source code here.