简体   繁体   English

.net 4.0运行时的.net 3.5应用程序

[英].net 3.5 application on .net 4.0 runtime

If I have an application built to target .net 3.5, will it run if all the user has installed is .net 4.0? 如果我有一个针对.net 3.5构建的应用程序,如果所有用户都安装了.net 4.0,它会运行吗? A link to official msdn documentation stating this would put my worries to rest. 官方msdn文档的链接说明这将使我的担忧得到休息。

Yes, it can. 是的,它可以。 You can say that you support .NET 4 in your app.config file: 您可以说在app.config文件中支持.NET 4:

<configuration>
  <startup>
    <supportedRuntime version="v4.0" /> 
  </startup>
</configuration>

Note that changes in the framework may break your app. 请注意,框架中的更改可能会破坏您的应用。 For details, see MSDN's list of .NET 4 migration issues , which includes recommended changes. 有关详细信息,请参阅MSDN的.NET 4迁移问题列表,其中包括建议的更改。

If you still want to support users with only .NET 3.5 installed, you also need to add a <supportedRuntime version="v2.0.50727" /> element: 如果您仍想支持仅安装了.NET 3.5的用户,还需要添加<supportedRuntime version="v2.0.50727" />元素:

<configuration>
  <startup>
    <supportedRuntime version="v4.0" /> 
    <supportedRuntime version="v2.0.50727" /> 
  </startup>
</configuration>

Note that the above configuration prefers .NET 4.0 if that is installed. 请注意,如果安装了.NET 4.0,则上述配置更喜欢.NET 4.0。 Changing the order above makes the application prefer .NET 3.5 if that is installed. 更改上面的顺序使应用程序更喜欢.NET 3.5(如果已安装)。 A complete table of possible configurations and effects can be found in MSDN's how-to on configuring your app to support .NET 4.0 or 4.5 . 有关可能的配置和效果的完整表格可以在MSDN的配置应用程序以支持.NET 4.0或4.5的方法中找到

The answer is most probably, and here are the MSDN tools to determine if your app will have issues. 答案很可能,这里有MSDN工具来确定您的应用程序是否会出现问题。

http://msdn.microsoft.com/en-us/library/ff602939.aspx http://msdn.microsoft.com/en-us/library/ff602939.aspx

MSDN MSDN

This is important:"The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance." 这很重要:“.NET Framework 4与使用早期.NET Framework版本构建的应用程序高度兼容,除了为提高安全性,标准合规性,正确性,可靠性和性能而进行的一些更改。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM