且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

转换MVC 2 ASPX到MVC 4的Razor视图引擎

更新时间:2023-12-06 12:07:22

在Visual Studio 2012中新的MVC4项目,并从旧的解决方案,一次添加源文件到您的新的解决方案之一。从MVC3移动到MVC4是一个新的解决方案更容易,我必须想象,从2去 - > 4会更加复杂,尝试就地升级

Create a new MVC4 project in Visual Studio 2012 and add source files from your old solution to your new solution one at a time. Moving from MVC3 to MVC4 is easier with a new solution, I have to imagine that going from 2 -> 4 would be even more complex to try to upgrade in-place.

转换,从ASPX剃刀也许应该手动完成。虽然有转换器在那里(如这个或code像的这太问题),我个人我的应用程序不会相信纯粹的自动化

Conversion from ASPX to Razor should probably be done manually. Although there are converters out there (like this one or code like the accepted answer in this SO question), I personally wouldn't trust my application to pure automation.

另外,我可能会转换一次。 >剃刀或MVC2 - - 换句话说,从ASPX转换> MVC4第一,确保一切工作与你的转换。然后转换成另一种,这样,如果您遇到任何问题,你不必揣摩无论是版本升级或导致你的问题的语法升级。

Also, I would probably convert one at a time. In other words, convert from ASPX -> Razor or MVC2 -> MVC4 first and make sure everything works with your conversion. Then convert the other one so that if you run into any problems, you don't have to try to figure out whether it's the version upgrade or the syntax upgrade that caused your problem.