转换一个ASP.NET MVC 3项目为MVC 4 [英] Converting a ASP.NET MVC 3 Project to MVC 4

查看:91
本文介绍了转换一个ASP.NET MVC 3项目为MVC 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该采取什么措施来安全地升级现有的ASP.NET MVC 3项目,以最新的ASP.NET MVC 4 开发preVIEW

What steps should I take to safely upgrade an existing ASP.NET MVC 3 project to the latest ASP.NET MVC 4 Developer Preview?

推荐答案

主要的变化是升级到最新版本(4.0 /2.0)的相关引用。您需要更新您的Web配置文件来升级以下命名空间的版本

The major change is to upgrade the relevant references to the latest version (4.0 /2.0). You need to update your web config files to upgrade the version of the following namespaces


  • System.Web.Mvc(更改为4.0.0.0)

  • System.Web.Webpages(更改为2.0.0.0)

  • System.Web.Helpers(更改为2.0.0.0)

  • System.Web.WebPages.Razor(更改为2.0.0.0)

另外你需要更新根级Web配置文件有这些的AppSettings项

Also you need to update the root level web config file to have these appsettings entries

<appSettings>
  <add key="webpages:Version" value="2.0.0.0" />
  <add key="PreserveLoginUrl" value="true" />
</appSettings>

然后,你需要更新项目中引用的DLL文件。删除现有的MVC3 dll引用,并添加MVC4(使用的NuGet软件包管理器做到这一点)

Then you need to update the DLLs referenced in the project. Remove the existing MVC3 dll reference and add MVC4 (use nuget package manager to do this)

链接处理转换的各个方面。必要时请参考它。

This link handles all aspects of the conversion. Refer it as needed.

这篇关于转换一个ASP.NET MVC 3项目为MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆