Introduction
In this article we discuss about how to migrate an MVC 3 application to MVC 5.
Step 1: Open your MVC 3 application in Visual Studio and change the .net framework to 4.5 as MVC 5 runs on this framework.
Project → Properties → Application → Target Framework → 4.5
Note: targetFramework in Web.Config will be changing to 4.5
Step 2: Install Asp.Net MVC 5 version through Package Manager Console.
Run this Command: Install-Package Microsoft.AspNet.Mvc -Version 5.2.3
Nuget Package Manage → Package Manager Console and run above command.

Step 3: Go to Web.Config(root level) and change,
<add key="webpages:Version" value="1.0.0.0" />
to
<add key="webpages:Version" value="3.0.0.0" />
Step 4: Check System.Web.Razor, System.Web.Helpers, System.WebPages.Razor versions. These all should be having versions 3.0.0.0. If they don't have Version 3.0.0.0, Install these packages using Nuget.
Step 5: Now, Build the solution. It this point you may get the following error
Error CS0104 'Compare' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute'
to solve the above issue add using CompareAttribute = System.Web.Mvc.CompareAttribute; in the namespace.
Step 6: Now, Open Web.Config(root level) and change the System.Web.Mvc version to 5.0.0.0,
- <assemblies>
- <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
- <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- </assemblies>


Rakesh KumarPosted May 23, 2019, 2:55 PM
Step 1: Open your MVC 3 application in Visual Studio. Which VS do you recommend VS 2013/2015 or VS 2017? Thanks
Nigel FernandesPosted Aug 6, 2017, 8:30 PM
What if the MVC view pages were using asp.net and we also need to change those to razor?
Paul PhillipsPosted Apr 20, 2017, 7:41 AM
Couple hints to do prior to upgrade: 1) if exists, remove bin_deployableAssembiles folder, 2) remove existing references to the any of the assemblies mentioned above.
Ramesh PalaniappanPosted Aug 11, 2016, 9:22 AM
Nice Share