简体   繁体   English

App.config中的.NET SupportedRuntime

[英].NET SupportedRuntime in App.config

I am compiling ac# application targeting .NET 3.5 as the runtime 我正在编译以.NET 3.5为目标的ac#应用程序作为运行时

In the app.config I am specifying , the recommended supported version tag for 3.5 as per http://msdn.microsoft.com/en-us/library/w4atty68.aspx 在我指定的app.config中,根据http://msdn.microsoft.com/en-us/library/w4atty68.aspx指定3.5的推荐支持版本标签

What will happen if a computer does not have version .NET 3.5 given I specify .NET 2.0 as the SupportedRuntime ? 如果我将.NET 2.0指定为SupportedRuntime,那么如果计算机没有.NET 3.5版本会发生什么?

Cheers Scott 干杯斯科特

Version 3.5 is basically version 2.0 of the CLR. 版本3.5基本上是CLR的2.0版本。 Regardless of what you define, if you have used any of the features of .NET 3.5 or 3.0 on a machine which has only version 2.0, you will get an error. 无论您定义什么,如果您在仅具有版本2.0的计算机上使用了.NET 3.5或3.0的任何功能,您将收到错误。

Value of the version will be the same for 2.0, 3.0, 3.5 and 3.5 SP1: 对于2.0,3.0,3.5和3.5 SP1,版本的值将相同:

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

The SupportedRuntime version lists the CLR version, not the framework version. SupportedRuntime版本列出了CLR版本,而不是框架版本。 You use v2.0.50727 for any .NET framework version between 2.0 and 3.5 SP1. 对于2.0和3.5 SP1之间的任何.NET框架版本,您都使用v2.0.50727。

Your app will bomb with a FileNotFound exception when you use an assembly that's only available in 3.0 or 3.5 and you try to run it on 2.0. 当您使用仅在3.0或3.5中可用的程序集并尝试在2.0上运行时,您的应用程序将使用FileNotFound异常进行炸弹。 Including the 3.5 bootstrapper in a Setup project (added by default) is a simple way to avoid this mishap. 在安装项目中包含3.5引导程序(默认添加)是避免此事故的简单方法。

该程序应该崩溃.Net运行时错误。

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

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