从Asp.net MVC2迁移到MVC4

时间:2022-08-26 21:29:06

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.

我想将MVC2网站转换为MVC4。我知道有一些工具可以帮助从MV2转换到MVC3,但我找不到从MVC2转换为MVC4所需的任何工具或步骤。请指向一些文章/博客,它可以为我提供更多信息来帮助完成此过程。

4 个解决方案

#1


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.

看起来现在有一个类似问题的解决方案,表明存在两个可以从MVC 2迁移到MVC 3然后从MVC 3迁移到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. 确保已将解决方案从VS2008升级到VS2010
  3. ASP.NET MVC 3 Application Upgrader - A Standalone package for upgrading MVC2 -> MVC3
  4. ASP.NET MVC 3 Application Upgrader - 用于升级MVC2的独立包 - > MVC3
  5. UpgradeMvc3ToMvc4 - A nuget package for upgrading from MVC3 -> MVC4
  6. UpgradeMvc3ToMvc4 - 用于从MVC3升级的nuget包 - > MVC4

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

最近我使用了这两个,我可以为他们担保,因为他们对我很有用。

#2


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到MVC 4的直接路径。需要完成MVC 3的中间步骤。

MVC 2 to MVC 3 then MVC 3 to MVC 4

MVC 2到MVC 3然后是MVC 3到MVC 4

#3


1  

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

在发行说明中有专门针对此的部分。

#4


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.

就个人而言,我发现转换通常会出现小故障和问题。我更喜欢直接路由并创建一个新的MVC项目,然后将所有控制器,视图,内容等移动到新项目中。确保添加您可能正在使用的任何包(但我怀疑您在MVC2应用程序中使用NuGet),并配置项目设置以匹配原始。

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.

对于中型项目,您可以在大约5分钟内执行此操作,在大型项目中可以执行10-15分钟,而转换项目可能需要很长时间来解决各种问题。

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.

这没有考虑到MVC2和3之间的任何重大变化,但幸运的是,这些变化非常小,大多数人从来没有。任何项目升级实用程序都会遇到同样的问题。

#1


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.

看起来现在有一个类似问题的解决方案,表明存在两个可以从MVC 2迁移到MVC 3然后从MVC 3迁移到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. 确保已将解决方案从VS2008升级到VS2010
  3. ASP.NET MVC 3 Application Upgrader - A Standalone package for upgrading MVC2 -> MVC3
  4. ASP.NET MVC 3 Application Upgrader - 用于升级MVC2的独立包 - > MVC3
  5. UpgradeMvc3ToMvc4 - A nuget package for upgrading from MVC3 -> MVC4
  6. UpgradeMvc3ToMvc4 - 用于从MVC3升级的nuget包 - > MVC4

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

最近我使用了这两个,我可以为他们担保,因为他们对我很有用。

#2


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到MVC 4的直接路径。需要完成MVC 3的中间步骤。

MVC 2 to MVC 3 then MVC 3 to MVC 4

MVC 2到MVC 3然后是MVC 3到MVC 4

#3


1  

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

在发行说明中有专门针对此的部分。

#4


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.

就个人而言,我发现转换通常会出现小故障和问题。我更喜欢直接路由并创建一个新的MVC项目,然后将所有控制器,视图,内容等移动到新项目中。确保添加您可能正在使用的任何包(但我怀疑您在MVC2应用程序中使用NuGet),并配置项目设置以匹配原始。

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.

对于中型项目,您可以在大约5分钟内执行此操作,在大型项目中可以执行10-15分钟,而转换项目可能需要很长时间来解决各种问题。

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.

这没有考虑到MVC2和3之间的任何重大变化,但幸运的是,这些变化非常小,大多数人从来没有。任何项目升级实用程序都会遇到同样的问题。