Upgrading a project to MVC 5

2019-03-09 16:08发布

问题:

I have been looking for a solution to upgrade a current MVC 4 app that i have to use the new MVC 5 binaries. I cannot find a solution anywhere.

Anyone have any ideas?

回答1:

Visual Studio 2013 will automatically upgrade a project simply by allowing the Nuget Package Manager to run Updates.

Steps:

In Visual Studio 2013, open the project and right click on the project name to open the Properties window. Change the Target Framework to at least 4.5.

Then, on the project right click on the References item, and select Manage NuGet Packages. On the right side of the window select "Updates", and underneath select "All". This should begin a search for all packages needing to be updated. When the search completes an "Update All" button will appear which if clicked, will update all packages.

Note, my project had the UpgradeMvc3ToMvc4 package. It could not upgrade this so I uninstalled it first, but allowed the dll's to remain when asked.



回答2:

See https://docs.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2 Microsoft info. It works for me ...