【问题标题】:Couldn't Add NuGet Package无法添加 NuGet 包
【发布时间】:2021-04-15 18:28:23
【问题描述】:

当我尝试在 Xamarin.Forms 中将 Plugin.FirebasePushNotification 添加到我的 Xamarin.Android 项目时,我收到以下消息,并且未添加包。但是,它似乎在 iOS 和共享项目上运行良好。我该如何解决这个问题?

All packages and projects are compatible with MonoAndroid,Version=v11.0.
Package restore failed. Rolling back package changes

包还原期间的消息:

Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project Project.Android to resolve this issue. 
 Project.Android -> Project -> Plugin.FirebasePushNotification 3.3.10 -> Xamarin.Android.Support.v4 28.0.0.3 -> Xamarin.Android.Support.Media.Compat 28.0.0.3 -> Xamarin.Android.Support.VersionedParcelable 28.0.0.3 -> Xamarin.Android.Support.Collections (= 28.0.0.3) 
 Project.Android -> Project -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections (= 28.0.0.1).
Restore failed.

【问题讨论】:

  • 您是否尝试过清除 Nuget 缓存?您可以通过转到工具 -> 选项... -> Nuget 数据包管理器 -> 常规 -> 清除所有 Nuget 缓存 来做到这一点
  • 如何在 Visual Studio for Mac 上执行此操作?没有看到选项...
  • 另外,当我尝试恢复我的包时,它显示“无法恢复包”
  • @ums2026 您可以尝试在 NuGet 中更新所有包,例如 Xamarin.forms。如果可能,您能否在输出窗口中提供详细信息?

标签: xamarin xamarin.android nuget nuget-package nuget-package-restore


【解决方案1】:

尝试通过命令行清除 NuGet 缓存:

nuget locals all -clear

要设置nuget,您可以查看NuGet CLI referencema​​cOS/Linux部分。

【讨论】:

  • 试过了,可惜没成功。
【解决方案2】:

通过手动编辑 .csproj 文件以按照错误中的说明包含包来解决问题。

【讨论】:

    猜你喜欢
    • 2017-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多