gpt4 book ai didi

.net-4.0 - app.config "forced"(?) on .net 4.0 .. 需要吗?

转载 作者:行者123 更新时间:2023-12-04 15:28:03 24 4
gpt4 key购买 nike

似乎在 VS 2010 Beta 2 中将项目升级到 .net 4.0 时,
生成一个 app.config 文件,大致如下所示:

<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

如果我只想拥有 .NET 4.0 可执行文件,是否需要此文件?
注意:有趣的是,这仅发生在 c# 中而不是 f# 项目中。

我已经成功删除了它,没有任何可见的(到目前为止)副作用。

任何人都可以详细说明它的重要性(如果有的话)

最佳答案

与应用程序在您的计算机上的行为方式无关,而是关于它在其他计算机上的行为方式,或者当您在您的机器上安装更新的 dotnet 运行时的情况。

基本上,如果你不包括这个,最新版本的 dotnet 运行时将用于运行你的应用程序。这听起来可能是件好事,直到您依赖的某些功能被弃用或您没有意识到自己依赖的错误得到修复。

更有用的是,当您最初构建的应用程序与旧版本的 dotnet 框架一起使用时,您可以在使用较新版本对其进行测试后使用此功能来断言,是的,它确实适用于最新版本。

这是来自 MSDN 的马嘴文字:

If the version of the .NET Framework that the application was built against is present on the computer, the application runs on that version.

If the version of the .NET Framework that the application was built against is not present and a configuration file does not specify a version in a Element, the application runs on the latest version of the .NET Framework that is present on the computer.

If the version of the .NET Framework that the application was built against is not present and the configuration file specifies a version in a Element, the application runs on the latest version that is specified in the application configuration file and is present on the computer.

关于.net-4.0 - app.config "forced"(?) on .net 4.0 .. 需要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2059307/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com