Migration from .NET 4 to 4.5 (MVC 5)

Updating existing nugget packages is very important because some are incompatible with the new one
Migration From .NET4 To 4.5(MVC5)

Migration from .NET 4 to 4.5 (MVC 5)

Updating existing nugget packages is very important because some are incompatible with the new one, before we start migrating process, its better to keep an existing copy.

Step 1:

Change the framework to 4.5.1. Change the target framework to 4.5 at least by right clicking the projects.

Target Framework

Step 2:

Packages have to be updated at the solution level. It will update the packages in all the projects in the solution. To do this, right click the solution and select 'Manage Nugget Packages for solution' option as shown below.

Manage Nugget Packages forsolution

Step 3:

From the install packages select the Microsoft.AspNet.Web.Helpers.Mvc packages and uninstall it, because it is renamed in the new version. To uninstall, click the Manage button and uncheck the web project and click ok.

Microsoft.AspNet.Web.Helpers.Mvc

Step 4:

Then go to the update packages and update some packages such as Microsoft.ASP.NET MVC, Entity Framework and Web API version 2. If you update top level packages, it will update other packages also. Now you can see the changes in packages.config file such as MVC 4 to MVC 5, Razor version change from 2 to 3 and also Webpage version from 2 to 3.

UpDate Entity Framework

Step 5:

Change the version in our config file as well like below. These are the changes in the top level config file.

Step 6:

Then also you need to do some changes in views config file.

Step 7:

Install one more package. Go to manage nugget manager option >> select online table >> search for Microsoft.Aspnet.Webhelpers and install the package.

Microsoft.Aspnet.Webhelpers

Step 8:

Unload the webproject and right click and select edit proj option and the remove the guide starting with E3 because we no need this guide in our new project.

Unload the webproject