gpt4 book ai didi

.net - 如何在通用 Windows 平台应用程序中更新一个特定的 dotnet 程序集?

转载 作者:行者123 更新时间:2023-12-01 11:29:35 25 4
gpt4 key购买 nike

我读到 dotnet 是开源的,并且是通过 nuget 而不是整体安装程序通过粒度包分发的。

我创建了一个简单的 UWP 应用程序,我在 project.json 中看到的是

{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

当我尝试通过 nuget 安装预发布 System.Collections 时,我得到了关注
Version conflict detected for System.Private.Uri. 
SM.W10 (≥ 1.0.0) -> System.Collections (≥ 4.0.11-beta-23516) -> System.Runtime (≥ 4.0.21-beta-23516) -> System.Private.Uri (≥ 4.0.1-beta-23516)
SM.W10 (≥ 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (≥ 5.0.0) -> Microsoft.NETCore.Runtime (≥ 1.0.0) -> Microsoft.NETCore.Runtime.CoreCLR-arm (≥ 1.0.0) -> System.Private.Uri (= 4.0.0).

我觉得我应该以某种方式打开 Microsoft.NETCore.UniversalWindowsPlatform但它有很多嵌套层级,而且嵌套很深 Microsoft.NETCore.Runtime.CoreCLR-arm System.Private.Url 有严格的版本

有什么方法可以轻松更新 System.Collections 吗?

最佳答案

由于包之间存在一些私有(private)依赖关系,例如 System.Runtime,UWP 应用在其第一个版本中固定了所有核心包。或 System.Collections和 .NETNative 工具链。因此,要测试任何最低级别合约的新版本,您还需要更新运行时包。

例如。

"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
"Microsoft.NETCore.Runtime": "1.0.1-beta-23516",
"System.Collections" : "4.0.11-beta-23516"
}

您只会在我们堆栈的最底部遇到这种行为,特别是
System.Collections,
System.Diagnostics.Contracts,
System.Diagnostics.Debug,
System.Diagnostics.StackTrace,
System.Diagnostics.Tools,
System.Diagnostics.Tracing,
System.Globalization,
System.Globalization.Calendars,
System.IO,
System.ObjectModel,
System.Reflection,
System.Reflection.Extensions,
System.Reflection.Primitives,
System.Resources.ResourceManager,
System.Runtime,
System.Runtime.Extensions,
System.Runtime.Handles,
System.Runtime.InteropServices,
System.Text.Encoding,
System.Text.Encoding.Extensions,
System.Threading,
System.Threading.Tasks,
System.Threading.Timer

UWP 的 future 版本不会有同样的问题。我们发现使用 NuGet 尝试强制执行私有(private)依赖项很脆弱,并且会产生令人困惑的错误。

关于.net - 如何在通用 Windows 平台应用程序中更新一个特定的 dotnet 程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33855314/

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