When trying to restore a NuGet package inside an Azure DevOps Build it failed with the following error message:
2019-11-13T09:17:59.8686867Z ##[section]Starting: NuGet restore
2019-11-13T09:17:59.8813825Z ==============================================================================
2019-11-13T09:17:59.8813825Z Task : NuGet Installer
2019-11-13T09:17:59.8813825Z Description : Installs or restores missing NuGet packages
2019-11-13T09:17:59.8813825Z Version : 0.2.31
2019-11-13T09:17:59.8813825Z Author : Microsoft Corporation
2019-11-13T09:17:59.8813825Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
2019-11-13T09:17:59.8813825Z ==============================================================================
2019-11-13T09:18:01.6050815Z [command]C:\Windows\system32\chcp.com 65001
2019-11-13T09:18:01.6050815Z Active code page: 65001
2019-11-13T09:18:01.6070347Z Detected NuGet version 3.3.0.212 / 3.3.0
2019-11-13T09:18:01.6080113Z SYSTEMVSSCONNECTION exists true
2019-11-13T09:18:01.6080113Z [command]D:\b\4\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe restore -NonInteractive D:\b\4\agent\_work\59\s\MestbankPortaal.sln -ConfigFile D:\b\4\agent\_work\59\s\nuget.config
2019-11-13T09:18:02.1119369Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2019-11-13T09:18:02.4713257Z Feeds used:
2019-11-13T09:18:02.4713257Z C:\Users\tfsservice\AppData\Local\NuGet\Cache
2019-11-13T09:18:02.4713257Z C:\Users\tfsservice\.nuget\packages\
2019-11-13T09:18:02.4713257Z http://tfs:8080/tfs/DefaultCollection/_packaging/Feed/nuget/v3/index.json
2019-11-13T09:18:02.4713257Z C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
2019-11-13T09:18:02.4713257Z
2019-11-13T09:18:02.4986705Z Restoring NuGet package IAM.Security.2.6.1.
2019-11-13T09:18:45.2347882Z WARNING: Unable to find version '2.6.1' of package 'IAM.Security'.
2019-11-13T09:18:45.2572523Z Unable to find version '2.6.1' of package 'IAM.Security'.
2019-11-13T09:18:45.2816698Z ##[error]Error: D:\b\4\agent\_work\_tasks\NuGetInstaller_333b11bd-d341-40d9-afcf-b32d5ce6f23b\0.2.31\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe failed with return code: 1
2019-11-13T09:18:45.2816698Z ##[error]Packages failed to install
2019-11-13T09:18:45.2855766Z ##[section]Finishing: NuGet restore
This was a package that was recently added to our private Azure Artifacts feed, but I was able to restore it without any problem on my local machine.
Eventually I found out that I could solve the problem by increasing the NuGet version used by the build process to version 4: