.NETcore、UWP - 无法安装 NuGet 包 [英] .NETcore, UWP - can't install NuGet package

查看:31
本文介绍了.NETcore、UWP - 无法安装 NuGet 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用通用 Windows 平台创建项目.我做了一些,但在下载 .NET Core 后,我遇到了 NuGet 包的问题.当我尝试安装 MySql.Data 我得到 <块引用>

包恢复失败.

输出:

MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0.某些软件包与 UAP 不兼容,Version=v10.0.MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0 (win10-arm).某些软件包与 UAP 不兼容,Version=v10.0 (win10-arm).MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0 (win10-arm-aot).某些软件包与 UAP 不兼容,Version=v10.0 (win10-arm-aot).MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0 (win10-x64).某些软件包与 UAP 不兼容,Version=v10.0 (win10-x64).MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0 (win10-x64-aot).某些软件包与 UAP 不兼容,Version=v10.0 (win10-x64-aot).MySql.Data 6.9.9 与 UAP 不兼容,Version=v10.0 (win10-x86).某些软件包与 UAP 不兼容,Version=v10.0 (win10-x86).MySql.Data 6.9.9 不兼容 UAP,Version=v10.0 (win10-x86-aot)

我读到我应该将 .NET core 更新到 5.2.2 版,但它没有用.我不知道该怎么办.我也有 BouncyCastle 包的问题,​​但我找到了 Portable-BouncyCastle 版本.

这是我的 project.json

<代码>{依赖关系":{"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",Portable.BouncyCastle 签名":1.7.0.2"},构架": {uap10.0":{}},运行时":{"win10-arm": {},"win10-arm-aot": {},win10-x86":{},"win10-x86-aot": {},win10-x64":{},win10-x64-aot":{}}}

解决方案

该问题是由于MySql.Data 与 UWP 不兼容造成的.当您看到包管理器输出时,会清楚地说明:

Package MySql.Data 6.9.9 与 uap10.0 (UAP,Version=v10.0) 不兼容.包 MySql.Data 6.9.9 支持:- net40 (.NETFramework,Version=v4.0)- net45 (.NETFramework,Version=v4.5)

我在 GitHub 上找到了一个 repo,这显然是试图采用兼容的MySql.Data 包中的 API 使应用程序可以通过 Windows Store 认证,但我没有尝试过.

然而,似乎可以将旧版本的 MySql.Data (6.9.7) 安装到 UWP 项目中,尽管以后无法将应用程序发布到应用商店 - 请参阅示例.

BouncyCastle 的问题非常类似,便携版兼容 UWP.

I try to create project using Universal Windows Platform. I did a few of them but after download .NET Core i have problem with NuGet Packages. When i try to Install MySql.Data i get

Package restore failed.

Output:

MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0.
Some packages are not compatible with UAP,Version=v10.0.
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-arm).
Some packages are not compatible with UAP,Version=v10.0 (win10-arm).
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-arm-aot).
Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot).
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-x64).
Some packages are not compatible with UAP,Version=v10.0 (win10-x64).
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-x64-aot).
Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot).
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-x86).
Some packages are not compatible with UAP,Version=v10.0 (win10-x86).
MySql.Data 6.9.9 is not compatible with UAP,Version=v10.0 (win10-x86-aot)

I read I should update .NET core to version 5.2.2 but it didn't work. I have no idea what should i do. I have also problem with BouncyCastle package but i found Portable-BouncyCastle version.

Here is my project.json

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
    "Portable.BouncyCastle-Signed": "1.7.0.2"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

解决方案

The problem is caused by the fact that MySql.Data is not compatible with UWP. When you see the Package Manager output, this is stated clearly:

Package MySql.Data 6.9.9 is not compatible with uap10.0 (UAP,Version=v10.0).
Package MySql.Data 6.9.9 supports:
  - net40 (.NETFramework,Version=v4.0)
  - net45 (.NETFramework,Version=v4.5)

I have found a repo on GitHub, that is apparently trying to take the compatible APIs from the MySql.Data package so that the app can pass Windows Store certification, but I have not tried it.

It seems however, that it was possible to install older versions of MySql.Data (6.9.7) into a UWP project, although it was not possible to publish the app to Store later - see the example here.

The problem with BouncyCastle is very analogous, the portable version is compatible with UWP.

这篇关于.NETcore、UWP - 无法安装 NuGet 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆