4
votes

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

1 Answers

6
votes

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.

enter image description here

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