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

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

问题描述

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

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,Version = 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软件包下从.NET Core 3.1迁移到.NET 5的兼容性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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