Azure Devops - Compatibility problems moving from .NET Core 3.1 to .NET 5 at Nuget Package

孤人 提交于 2020-12-12 09:10:30

问题


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.

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.

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

[error] The nuget command failed with exit code(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>

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

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.

Does someone have an idea?


回答1:


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

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.



来源:https://stackoverflow.com/questions/64842484/azure-devops-compatibility-problems-moving-from-net-core-3-1-to-net-5-at-nug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!