efcore: Azure DevOps error message "Package is not compatible with net60"
Apologies in advance if this is not the correct channel to ask this question.
My pipeline was working fine all this time until today. Suddenly I am getting this error message that the package is not compatible with Net60. This is strange to me because if there was an incompatibility issue, I would expect to see this when I build locally. I am sure something has changed in Azure DevOps agents, but I don’t know what and how to solve the problem. Any help to point me to the right direction is welcome.
Below is the error message:
The nuget command failed with exit code(1) and error(Errors in D:\a\1\s\Alpha.UI\Alpha.UI.csproj
Package Microsoft.EntityFrameworkCore.Analyzers 6.0.2 is not compatible with net60 (.NETFramework,Version=v6.0). Package Microsoft.EntityFrameworkCore.Analyzers 6.0.2 supports: netstandard2.0 (.NETStandard,Version=v2.0)
One or more packages are incompatible with .NETFramework,Version=v6.0.)
And below is the whole log output build-error.txt
Thank you.
Target framework: .NET 6.0 Visual Studio: 2022 VMImage: windows-2022 All packages are updated to their latest versions.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (4 by maintainers)
Hi, I had the same issue today. Out of the blue, the build pipeline was failing. As suggested (Thanks @ErikEJ!), I added the tool install task to the build and everything started to work again.
This may be helpful to someone:
The task defaults to 4.1 and you should run the Tool installer task to get the latest.
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/package/nuget?view=azure-devops
Thanks @FabrizioSalis your solution is exactly what I needed as I had identical issue. Build was fine yesterday, today BANG 😦 For anyone using the UI to built out their pipeline, the NuGet tool installer task will look like:
That is strange. The same pipeline in 2019 agents is using 5.8, but in 2022, it is using the default? I will use the Tool Installer as pointed out, but I would expect the task to use what is installed on the agent, by default, and if no version is found or the installed version I not what the developer wants then to use the Tool Installer. I guess I understood this incorrectly.
Your NuGet version is 5 years old, make sure to update, it does not understand .net 6 target:
2022-03-01T14:46:47.8227060Z Caching tool: NuGet 4.1.0 x64
Thank you. I just had the same problem, using a fast created classic pipeline with desktop. It’s using NuGet 4.4.1 by default and gave the above error message. I had no idea, it was the fault of an old NuGet version.
I would like to provide some more info. I was using as VM image the tag “windows-latest” which until recently was pointing to “windows-2019” agents. Microsoft changed that to “windows-2022”. Reading Erik’s response I can confirm from my pipeline logs that the “windows-2019” agents were using Nuget 5.8. But the “windows-2022” agents are using the 4.1 version. Which I find odd. According to this link https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md they should be using 6.1. I guess there is an issue here regarding the agent setup?
I understand my problem now. Thank you Erik for your help pointing me in the right direction. I will proceed with the necessary build corrections to start using the right Nuget version.