gpt4 book ai didi

c# - 是否可以在 app.config 中的 "supportedRuntime"中指定 .NET 服务包?

转载 作者:太空狗 更新时间:2023-10-29 21:59:33 24 4
gpt4 key购买 nike

我有一个应用程序可以在 .Net 2.0 SP2 上正常运行,但无法在 .NET 2.0 RTM 上正常运行。 (仅供引用:调用托管 DLL 的方法时失败,该 DLL 是用于 USB 编程的 native DLL 的包装器)。

我知道您可以在 C# .NET 应用程序的 app.config 中提供受支持的运行时

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

但是,是否也可以指定特定的服务包版本?

谢谢!

编辑:我现在确实发现在 2.0 和 2.0 SP2 之间哪个方法失败了。它是在 2.0 SP1 中添加的 WaitHandle.WaitOne(int)。

给遇到问题的其他人的提示,编译器什么也没说,但如果你用有问题的运行时生成可执行文件,它确实会给你确切的错误。

例如:

Warning: System.MissingMethodException: Method not found: 'Boolean System.Threading.WaitHandle.WaitOne(Int32)'. while resolving 0xa0000e1 - System.Threading.WaitHandle.WaitOne.
11/11/2010 01:54:07 [3620]: Method not found: 'Boolean System.Threading.WaitHandle.WaitOne(Int32)'. while compiling method XXX

罗杰

最佳答案

可以找到很好的解释here关于为什么这是不可能的。您可以找到一个 SO 响应 here以满足您的需求。

<supportedRuntime>实际上并不能那样工作,因为 3.5 框架使用 2.0 运行时。您只能以这种方式指定runtimes,而不是frameworks,并且该元素仅表示偏好,而不是需求。

关于c# - 是否可以在 app.config 中的 "supportedRuntime"中指定 .NET 服务包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4135308/

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