app.config< supportedRuntime> [英] app.config <supportedRuntime>

查看:209
本文介绍了app.config< supportedRuntime>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个WinForms应用程序是使用VS2008构建和编译的.NET 2.0。



这是我的理解,在运行时,应用程序将尝试加载.NET 2.0 CLR第一,(因为这是编译的对象), 不管 任何可能列出在app.config的任何supportedRuntime元素文件。



如果找不到它,那么它将通过检查app.config等来处理另一个版本。



例如,如果在计算机上安装了.NET 2/3 / 3.5和.NET 4.0,并且我有:

 < supportedRuntime> V4.0< / supportedRuntime> app.config中的

,应用程序仍然会选择加载并运行.NET 2.0。 p>

是否正确?



谢谢。

解决方案

MSDN页面似乎很清楚,用于构建的只是后备情况:



http://msdn.microsoft.com/en-us/library/w4atty68.aspx p>


如果< supportedRuntime>元素不存在于应用程序配置文件中,则使用用于构建应用程序的运行时版本。


与此MSDN页面不匹配?


Suppose I have a WinForms app that is built and compiled against .NET 2.0 using VS2008.

It is my understanding that at runtime, the app will attempt to load the .NET 2.0 CLR first, (because that is what it was compiled against), regardless of anything that may be listed in any "supportedRuntime" element of the app.config file.

If it can't find it, then it will then go through a process of deciding on another version by checking the app.config, etc.

For example, if .NET 2/3/3.5 and .NET 4.0 are installed on a machine, and I have:

<supportedRuntime>V4.0</supportedRuntime>

in the app.config, the app will still choose to load and run .NET 2.0.

Is that correct?

Thanks.

解决方案

The MSDN page seems to be clear that the one used to build is only the fallback case:

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

If the <supportedRuntime> element is not present in the application configuration file, the version of the runtime used to build the application is used.

Are you seeing behavior that doesn't match that of this MSDN page?

这篇关于app.config&lt; supportedRuntime&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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