简体   繁体   中英

.NET SupportedRuntime in App.config

I am compiling ac# application targeting .NET 3.5 as the runtime

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

What will happen if a computer does not have version .NET 3.5 given I specify .NET 2.0 as the SupportedRuntime ?

Cheers Scott

Version 3.5 is basically version 2.0 of the CLR. 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.

Value of the version will be the same for 2.0, 3.0, 3.5 and 3.5 SP1:

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

The SupportedRuntime version lists the CLR version, not the framework version. You use v2.0.50727 for any .NET framework version between 2.0 and 3.5 SP1.

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. Including the 3.5 bootstrapper in a Setup project (added by default) is a simple way to avoid this mishap.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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