14

I want to convert MVC2 web site to MVC4. I know there are tools to help with conversion from MV2 to MVC3 but I cannot find any tools or steps needed to convert from MVC2 to MVC4. Please point me to some article/blog which can provide me some more information to help with this process.

vik
  • 141
  • 1
  • 1
  • 3

4 Answers4

17

Looks like there is now a solution posted to a similar question that indicates that there exist two packages that can migrate from MVC 2 to MVC 3 and then from MVC 3 to MVC 4.

Here is what you'll need based on my experience doing the same upgrade recently:

  1. Ensure that you have upgraded your solution from VS2008 to VS2010
  2. ASP.NET MVC 3 Application Upgrader - A Standalone package for upgrading MVC2 -> MVC3
  3. UpgradeMvc3ToMvc4 - A nuget package for upgrading from MVC3 -> MVC4

Having used both of these recently I can vouch for them in that they worked very well for me.

Community
  • 1
  • 1
mezoid
  • 28,090
  • 37
  • 107
  • 148
  • 1
    Be aware that when you go run #2 that if you are connected to TFS then I had to check out for edit the mvc project, the root web.config and the Views/web.config file in order for the upgrade to succeed. – JustinMichaels Jul 27 '13 at 14:20
  • @mezoid Thanks it worked for me however I'm facing issues if I'm trying to upgrade to MVC 5 (first i upgraded .NET Framework from 4.0 to 4.6.1) – vibs2006 Oct 24 '17 at 10:57
2

Unfortunately there isn't a direct path from MVC 2 to MVC 4. The intermediate step to MVC 3 needs to be done.

MVC 2 to MVC 3 then MVC 3 to MVC 4

MushinNoShin
  • 4,695
  • 2
  • 32
  • 46
1

There's a section dedicated for this in the release notes.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • 6
    Technically that's dedicated to MVC3->MVC4. Some of us are wondering if there is a better option than MVC2->MVC3 followed by MVC3->MVC4. – Carl G Oct 05 '12 at 20:16
1

Personally, I find that conversions often have small glitches and issues. I prefer to just take the direct route and create a new MVC project, then move all the controllers, views, content, etc.. to the new project. Make sure to add in any packages you may be using (but I doubt you're using NuGet in an MVC2 app), and configure the project settings to match the original.

You can do this in about 5 minutes for a medium sized project, and maybe 10-15 in a large one, whereas converting projects can take a long time to sort out the various issues.

This doesn't take into account any breaking changes between MVC2 and 3, but thankfully those are pretty minimal and most people never have any. You would have the same issue with any project upgrade utility.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291