0
votes

I am developing an ASP.NET Core 3.1 API which is referring to a .NET Standard 2.1 class library. It's working fine as expected when I run the API from my local machine using Visual Studio (without any errors and warnings).

But when I am deploying using Azure DevOps, the build is failing with the below message:

Build Steps 2 error(s), 0 warning(s)
The nuget command failed with exit code(1) and error(NU1201: Project ISOXMLValidationLibrary is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project ISOXMLValidationLibrary supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1201: Project ISOXMLValidationLibrary is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project ISOXMLValidationLibrary supports: netstandard2.1 (.NETStandard,Version=v2.1)

Errors in
D:\a\1\s\ISOXMLValidationApi\ISOXMLValidationApi\ISOXMLValidationApi.csproj NU1201: Project ISOXMLValidationLibrary is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project ISOXMLValidationLibrary supports: netstandard2.1 (.NETStandard,Version=v2.1) Errors in D:\a\1\s\ISOXMLValidationApi\ISOXMLValidationApiTest\ISOXMLValidationApiTest.csproj NU1201: Project ISOXMLValidationLibrary is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project ISOXMLValidationLibrary supports: netstandard2.1 (.NETStandard,Version=v2.1))

Packages failed to restore

Please let me know how to fix this issue?

2

2 Answers

0
votes

In my case the issue was due to old Nuget version. Try changing the Nuget version to a newer one (preferably latest). You can find the list of versions available in TFS or Azure DevOps server at https://dist.nuget.org/tools.json

-1
votes

I have solved the issue by changing the Target Framework of class library from .net standard 2.1 to .net standard 2.0.