gpt4 book ai didi

xamarin - 更新到 Visual Studio 2017 版本 15.8 预览版后,出现 "Can not resolve reference: ` System.Memory `"或 "Could not find ` System.Memory `"

转载 作者:行者123 更新时间:2023-12-02 08:50:08 24 4
gpt4 key购买 nike

如果它可能对其他人有帮助,我将询问并回答这个关于从 Visual Studio 2017 版本 15.7 更新到版本 15.8 预览版后 Xamarin.Android 和 Xamarin.iOS 项目中可能出现的问题的小问题。

演示该问题的示例步骤

  1. 创建一个新的空白 Xamarin.Android 或 Xamarin.iOS 项目。
  2. 将 Microsoft.AspNetCore.SignalR.Client.Core 版本 1.0.0 NuGet 包添加到项目中。
  3. 使用项目中 NuGet 包中的类型。例如,将以下行添加到任何现有方法中:

    var connection = new Microsoft.AspNetCore.SignalR.Client.HubConnectionBuilder().Build();
  4. 对于 Xamarin.Android,尝试在调试配置中构建项目。对于 Xamarin.iOS,在 iPhone 模拟器上的调试配置中构建并运行应用程序。

Visual Studio 2017 版本 15.7 的结果

Xamarin.Android 应用和 Xamarin.iOS 应用均构建并运行,没有错误。

Visual Studio 2017 版本 15.8 预览版 4 的结果

对于 Xamarin.Android,构建失败:

Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `Microsoft.AspNetCore.Connections.Abstractions`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `Microsoft.AspNetCore.Connections.Abstractions`.
Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `Microsoft.AspNetCore.SignalR.Client.Core`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `Microsoft.AspNetCore.SignalR.Client.Core`.
Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `Microsoft.AspNetCore.SignalR.Common`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `Microsoft.AspNetCore.SignalR.Common`.
Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `Microsoft.AspNetCore.SignalR.Protocols.Json`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `Microsoft.AspNetCore.SignalR.Protocols.Json`.
Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `Microsoft.Extensions.Primitives`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `Microsoft.Extensions.Primitives`.
Xamarin.Android.Common.targets(1831,2): error XA2002: Can not resolve reference: `System.Memory`, referenced by `System.IO.Pipelines`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `System.IO.Pipelines`.

对于 Xamarin.iOS,应用程序在模拟器上成功启动,但调试输出显示应用程序在运行时无法找到 System.Memory:

Could not find `System.Memory` referenced by assembly `System.IO.Pipelines, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51`.
Could not find `System.Memory` referenced by assembly `Microsoft.AspNetCore.SignalR.Client.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`.
Could not find `System.Memory` referenced by assembly `Microsoft.AspNetCore.SignalR.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`.
Could not find `System.Memory` referenced by assembly `Microsoft.Extensions.Primitives, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`.
Could not find `System.Memory` referenced by assembly `Microsoft.AspNetCore.Connections.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`.
Could not find `System.Memory` referenced by assembly `Microsoft.AspNetCore.SignalR.Protocols.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60`.

如何解决这些错误?后续,为什么我更新Visual Studio后会出现这些错误?

最佳答案

我使用 VS Entreprise 2017 版本 15.9.1

要解决我面临的问题(无法解析引用:System.Buffers,由System.Memory引用。请为添加NuGet包或程序集引用>System.Buffers,或删除对 System.Memory 的引用。),我只是通过以下命令安装 System.Buffers 包:

安装包 System.Buffers -版本 4.5.0

https://www.nuget.org/packages/System.Buffers/

关于xamarin - 更新到 Visual Studio 2017 版本 15.8 预览版后,出现 "Can not resolve reference: ` System.Memory `"或 "Could not find ` System.Memory `",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51296773/

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