Description
Required Information
Question, Bug, or Feature?
Type: Bug
Enter Task Name: NuGetCommand@2
Environment
- Server: Azure Pipelines
- Account: exclaimerltd
- Team Project Id: b677b16d-bceb-42e2-b5b8-c198664edbd8
- Build Definition Id: 2386
- Build Id: 219818
- Agent: Hosted Agent /
windows-latest
Issue Description
We have been using windows-latest
to run our builds which has all been good up until very recently when we understand that the switchover from windows-2019
to windows-2022
has happened, at which point several of our builds started failing due to NuGet issues. We raised this issue (actions/runner-images#5303) but it was closed saying that both 2019 and 2022 have the same NuGet version installed and to raise an issue here instead.
We noted that our previous builds running against windows-2019
were using NuGet 5.8.0 which we can see at the top of the NuGetCommand
task:
Caching tool: NuGet 5.8.0 x64
Found tool in cache: NuGet 5.8.0 x64
Resolved from tool cache: 5.8.0
Using version: 5.8.0
Found tool in cache: NuGet 5.8.0 x64
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 5.8.0.6930 / 5.8.0+830c8be45dbbccd411ecf6080abff0c2c98079cf.830c8be45dbbccd411ecf6080abff0c2c98079cf
Now on windows-2022
we are seeing this:
Caching tool: NuGet 4.1.0 x64
Found tool in cache: NuGet 4.1.0 x64
Resolved from tool cache: 4.1.0
Using version: 4.1.0
Found tool in cache: NuGet 4.1.0 x64
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 4.1.0.2450 / 4.1.0
The older version of NuGet then causes issues in our pipelines as it does not understand for example .NET 6 properly and fails with errors such as One or more packages are incompatible with .NETFramework,Version=v6.0.
, Package X is not compatible with net60 (.NETFramework,Version=v6.0).
or Package X is not compatible with net472 (.NETFramework,Version=v4.7.2). Package X supports: netstandard2.0 (.NETStandard,Version=v2.0)
We have been working around this issue by using the NuGetToolInstaller@1
task to install a newer version of NuGet and this works but we would not expect certainly a lower version of NuGet being used by default on windows-2022
vs windows-2019
.
Task logs
Please contact me if you need logs, I cannot share them publically due to potentially sensitive information in them.
Troubleshooting
Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting
As described above, we quickly worked out that it seems caused by the switch over to windows-2022
from windows-2019
and that we can workaround the issue using the NuGetToolInstaller@1
task so it's not critical, but we feel that this should not be the expected behaviour especially when NuGet 6.1.0 is installed on the hosted agent by default.
Error logs
##[error]The nuget command failed with exit code(1) and error(Errors in D:\a\1\s\test\<redacted>\<redacted>.csproj
Project <redacted> is not compatible with net60 (.NETFramework,Version=v6.0). Project <redacted> supports: netstandard2.0 (.NETStandard,Version=v2.0)
Package Azure.Identity 1.3.0 is not compatible with net60 (.NETFramework,Version=v6.0). Package Azure.Identity 1.3.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
One or more projects are incompatible with .NETFramework,Version=v6.0.
One or more packages are incompatible with .NETFramework,Version=v6.0.
Note for that one our project TFM is correctly set to net6.0
but the old NuGet version is interpreting it incorrectly.
From another failing build:
Package Azure.Data.Tables 12.4.0 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Azure.Data.Tables 12.4.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
One or more packages are incompatible with .NETFramework,Version=v4.7.2.