【问题标题】:How can i update one specific dotnet assembly in Universal Windows Platform app?如何在通用 Windows 平台应用程序中更新一个特定的 dotnet 程序集?
【发布时间】:2016-02-24 15:08:29
【问题描述】:

我了解到 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 吗?

【问题讨论】:

  • 我认为您可以在依赖项下放置一个条目,以引用您想要的 System.Collection 版本。只需将其放在 .NetCore 条目下即可

标签: .net nuget windows-10 uwp .net-core


【解决方案1】:

对于它的第一个版本,UWP 应用程序固定了所有核心包,因为 System.RuntimeSystem.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 的未来版本不会出现同样的问题。我们发现使用 NuGet 尝试强制执行私有依赖项很脆弱,并且会产生令人困惑的错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-07
    • 2023-03-25
    • 2018-10-21
    • 2016-04-25
    • 1970-01-01
    相关资源
    最近更新 更多