哪个 .NET 框架与 MVC 4?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12088902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which .NET framework with MVC 4?
提问by user517406
I have just installed MVC 4 and am looking at using it with VS 2010. I notice that by default when creating a project the .NET framework is 4.0, yet the example code I am looking at uses framework 4.5. If I want to utilise all the features of MVC 4 do I need to install framework 4.5, or should 4.0 be enough?
我刚刚安装了 MVC 4 并且正在考虑将它与 VS 2010 一起使用。我注意到在创建项目时默认情况下 .NET 框架是 4.0,但我正在查看的示例代码使用框架 4.5。如果我想利用 MVC 4 的所有功能,我需要安装框架 4.5,还是 4.0 就足够了?
EDIT : Seems like I will go with 4.0, although will 4.5 be the default framework in VS2012? If so, I would probably prefer to install that to save having to make framework changes later.
编辑:似乎我会使用 4.0,尽管 4.5 会是 VS2012 中的默认框架吗?如果是这样,我可能更愿意安装它以节省以后进行框架更改的时间。
回答by Steve
Look at the MVC4 download page. There is a requirements section saying:
查看 MVC4下载页面。有一个要求部分说:
Supported operating systems: Windows 7, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP
.NET 4, ASP.NET 4, Visual Studio 2010 or Visual Web Developer 2010 are required to use certain parts of this feature.
支持的操作系统:Windows 7、Windows Server 2003、Windows Server 2008、Windows Server 2008 R2、Windows Vista、Windows XP
使用此功能的某些部分需要 .NET 4、ASP.NET 4、Visual Studio 2010 或 Visual Web Developer 2010。
回答by Adam Tuliper - MSFT
You need .NET 4 and Visual Studio 2010 at a minimum but CAN use more features with ASP.NET 4.5.
您至少需要 .NET 4 和 Visual Studio 2010,但可以通过 ASP.NET 4.5 使用更多功能。
VS2010 will only support framework 4 features, and thus async/await will not be supported. For those features you need ASP.NET 4.5. This applies to the Web API as well for example this requires 4.5: http://blogs.msdn.com/b/henrikn/archive/2012/03/03/async-mashups-using-asp-net-web-api.aspx
VS2010 将仅支持框架 4 功能,因此将不支持 async/await。对于这些功能,您需要 ASP.NET 4.5。这也适用于 Web API,例如这需要 4.5:http: //blogs.msdn.com/b/henrikn/archive/2012/03/03/async-mashups-using-asp-net-web-api。 aspx
A standard controller/view scenario in MVC4 will work in VS2010 on ASP.NET 4.
MVC4 中的标准控制器/视图场景将在 ASP.NET 4 上的 VS2010 中工作。
回答by adatapost
Undoubtedly no need to install 4.5 (mvc4-release-notes). ASP.NET MVC 4 is available for framework version 4.0 as well 4.5.
毫无疑问,不需要安装 4.5 ( mvc4-release-notes)。ASP.NET MVC 4 可用于框架版本 4.0 和 4.5。
回答by rism
If you're just writing an app as you go then just write and compile. That will tell you if you have what you need. Tho:
如果您只是在编写应用程序,那么只需编写和编译即可。这会告诉你是否有你需要的东西。寿:
Utilise all the features of MVC
利用MVC的所有功能
does not sound very user-centric ;)
听起来不太以用户为中心 ;)
Also do yourself a favor and deploy to IIS as your development server NOT Cassini or whatever its called nowadays.
也帮自己一个忙,并将其部署到 IIS 作为您的开发服务器,而不是 Cassini 或现在的任何名称。

