Azure Devops - Nuget Package 从 .NET Core 3.1 迁移到 .NET 5 的兼容性问题 [英] Azure Devops - Compatibility problems moving from .NET Core 3.1 to .NET 5 at Nuget Package

查看:24
本文介绍了Azure Devops - Nuget Package 从 .NET Core 3.1 迁移到 .NET 5 的兼容性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .NET Core 解决方案,它使用 .NET Core 3.1 在 Azure Devops 上使用管道运行良好.管道上一切正常.

I have a .NET Core solution which was running well using .NET Core 3.1 using a Pipeline on Azure Devops. Everything was working fine on the Pipeline.

从 .NET Core 3.1 迁移到 .NET 5.0 后,我开始在运行管道时遇到一些奇怪的问题,尤其是 Nuget 包.

After moving from .NET Core 3.1 to .NET 5.0, I started to have some strange troubles running the pipeline, specifically with Nuget packages.

我可以毫无问题地进行构建,但是当它开始使用 Nuget Package 打包时,我遇到了这个错误:

I can build with no problems, but when it starts to pack using Nuget Package, I've got this error:

[错误] nuget 命令失败,退出代码 (1)

[error] The nuget command failed with exit code(1)

NU1202:Microsoft.EntityFrameworkCore 5.0.0 包与 net50 不兼容(.NETFramework,版本 = v5.0).包 Microsoft.EntityFrameworkCore 5.0.0 支持:netstandard2.1 (.NETStandard,Version=v2.1)

NU1202: Package Microsoft.EntityFrameworkCore 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

有些奇怪的事实是,这个解决方案在本地机器上运行良好.

Some weird fact is that this solution is running fine at the local machine.

<PropertyGroup>
  <TargetFramework>net5.0</TargetFramework>
  <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  <Version>1.8.8.9</Version>
  <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>

我已经尝试更改 Build 上的操作系统,但出现此错误:

I already tried to change the OS on the Build, but I've got this error:

MSBuild 的当前可用版本是 16.7.0.37604.将 global.json 中指定的 .NET Core SDK 更改为需要当前可用的 MSBuild 版本的旧版本.

The current available version of MSBuild is 16.7.0.37604. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

有人有想法吗?

推荐答案

包 Microsoft.EntityFrameworkCore.Relational 5.0.0 支持:netstandard2.1 (.NETStandard,Version=v2.1)

Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

这是因为它使用的是旧版本的 Nuget.您可以尝试将其更改为5.x 并恢复.

This is because it was using an old version of Nuget. You can try to change it to 5.x and restore.

这是一个案例,您可以参考类似的问题.

Here is a case with similar issue you can refer to.

这篇关于Azure Devops - Nuget Package 从 .NET Core 3.1 迁移到 .NET 5 的兼容性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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