Is it possible to upgrade an existing MVC4 Web application to MVC5?

回眸只為那壹抹淺笑 提交于 2019-12-10 23:27:00

问题


The reason why I want to upgrade from MVC4 to MVC5 is because MVC5 has Entity Framework Identity already there. I don't want to spend time trying to add Identity to my MVC4 project because it'll take too much time.

Is there like an update button which does it automatically or do I need to create a MVC5 template and copy codes over?


回答1:


I upgraded form MVC4 to MVC5 by following the steps at this link

How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2

that walk you through steps to upgrade from MVC4 to MVC5

Here is a quick summary of the upgrade steps.

  1. Backup your project, as it upgrade will involve changes to package configuration and web.config files.

  2. upgrade from Web API to Web API 2 by making some changes in global.asax

  3. Make sure all the packages that your projects use are compatible with MVC 5 and Web API 2. They provide a table of package versions from Microsoft packages

  4. Open project in Visual Studio.

  5. Using Package Manager Console (PMC), remove certain ASP.Net NuGet packages if installed.

  6. Upgrade all the ASP.Net NuGet packages using the PMC

They show how to: Update the Application web.config File and Update the web.config files under the Views folder

Check out the link and see if that helps.




回答2:


I upgraded from MVC4 to MVC5 by copying some files from the existing MVC4 project and some files from a new MVC5 web application project into a new empty project.

The issue for me was migrating from SimpleMembership authentication to Identity. I documented the steps I took in this answer: How to migrate from SimpleMembership to ASP.NET.Identity

If you aren't using SimpleMembership already, I would copy files straight from the MVC4 to the MVC5 Web Application.



来源:https://stackoverflow.com/questions/36172440/is-it-possible-to-upgrade-an-existing-mvc4-web-application-to-mvc5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!