【问题标题】:Xamarin Issue : error XA2002: Can not resolve reference: `System.Threading.Tasks.Extensions` referenced by `System.Reactive`Xamarin 问题:错误 XA2002:无法解析引用:`System.Reactive` 引用的`System.Threading.Tasks.Extensions`
【发布时间】:2019-11-06 10:33:59
【问题描述】:

我需要有关 Xamarin 表单的帮助。我有一个在 Visual Studio 2017(版本 15.9.13)中开发的 Xamarin 应用程序。我面临如下编译错误。我已经用其他团队成员更新的 Git 的最新版本更新了我的代码。之后我无法编译。

错误 XA2002:无法解析引用:System.Threading.Tasks.Extensions,由 System.Reactive 引用。请为 System.Threading.Tasks.Extensions 添加 NuGet 包或程序集引用,或删除对 System.Reactive 的引用。

我尝试通过 NuGet 安装以下库,但同样的错误。

  1. System.Threading.Tasks.Extensions (4.6.0-preview.18571.3)
  2. System.Reactive.Linq (4.2.0-preview.566)
  3. System.Reactive (4.2.0-preview.566)

我已经用最新版本更新了我的 VS2017。

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1898,2):错误 XA2002:无法解析参考:System.Threading.Tasks.Extensions ,由System.Reactive 引用。请为 System.Threading.Tasks.Extensions 添加 NuGet 包或程序集引用,或删除对 System.Reactive 的引用。

【问题讨论】:

  • 您使用预览版而不是稳定版是否有原因?能否请您分享更多您的错误日志?
  • 嗨 Saamer,这是最新的版本,所以已经安装了。我也尝试过使用稳定版本,然后得到相同的结果。我尝试了 3 到 4 个不同版本的构建。
  • 能否提供诊断 MSBuild 日志输出?

标签: c# xamarin xamarin.android visual-studio-2017 .net-standard


【解决方案1】:

尝试以下方法之一:

  1. System.Threading.Tasks.Extension 从 4.5.1 降级到 4.4.0 并将其用于:
    • System.Reactive 4.1.0 (latest)
    • System.Reactive.Interfaces 4.1.0 (latest)
    • System.Reactive.Linq 4.1.0( latest)
    • System.Reactive.PlatformServices (latest)
    • System.Threading 4.3.0 (latest)
    • System.Threading.Taks 4.3.0 (latest)
    • System.Threading.Tasks.Extensions 4.4.0 (downgraded)
  2. 保持 System.Threading.Tasks.Extensions 升级,将 System.Runtime.CompilerServices.Unsafe 安装到所有 Android、iOS 和 UWP 项目,并将 System.Reactive 降级到版本 4.0.0

另外,考虑切换到 VS 2019,VS 2019 的所有发行版本(包括 Mac 版)现在都应该附带固定版本的 Xamarin.Android。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-22
    • 2019-03-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多