.NETcore、UWP - 无法安装 NuGet 包

.NETcore, UWP - can't install NuGet package

我尝试使用通用 Windows 平台创建项目。我做了其中的一些,但是在下载 .NET Core 之后,我遇到了 NuGet 包的问题。当我尝试安装 MySql.Data 时,我得到

Package restore failed.

输出:

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)

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

这是我的 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": {}
  }
}

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

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)

我发现了一个 repo on GitHub,它显然是试图从 MySql.Data 包中获取兼容的 API,以便该应用程序可以通过 Windows 商店认证,但我没有试过了。

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

BouncyCastle的问题很相似,便携版兼容UWP