Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure: The nuget command failed with exit code(null) and error() - packages failed to restore

In Azure we have an pipeline which restores the nuget-packages of our C#-solution:

- task: NuGetCommand@2
    inputs:
        command: 'restore'
        restoreSolution: '$(solution)'
        feedsToUse: 'select'
        vstsFeed: 'xxxxxxxxxxxxxxx'
        includeNuGetOrg: true

The pipeline has always run smoothly so far. One day, however, we get the following error messages in the console:

##[error]The nuget command failed with exit code(null) and error()
##[error]Packages failed to restore
  • There are no further error messages in the console to give us an indication of the cause.
  • We use no caching.
  • Locally, in Visual Studio, the restore-command works well.

Has anyone an idea what´s wrong?

like image 423
Simon Avatar asked Oct 11 '25 12:10

Simon


2 Answers

It seems the latest version of nugetCommand2 is broken - have seen a github thread for it

revert your command to the latest working version - for us its - 2.238.1

so your command would be

- task: [email protected]
    inputs:
        command: 'restore'
        restoreSolution: '$(solution)'
        feedsToUse: 'select'
        vstsFeed: 'xxxxxxxxxxxxxxx'
        includeNuGetOrg: true
like image 108
Kacey Hickson Avatar answered Oct 14 '25 08:10

Kacey Hickson


There is a GitHub issue has reported the same problem occurs on the latest version (2.244.1) of NuGetCommand task. Looks like, there is defect on the task version 2.244.1.

As mentioned in the GitHub issue, you can force specify the task to a previous version that can work fine. For example.

- task: [email protected]
    inputs:
      command: 'restore'
      restoreSolution: '$(solution)'
      feedsToUse: 'select'
      vstsFeed: 'xxxxxxxxxxxxxxx'
      includeNuGetOrg: true

like image 35
Bright Ran-MSFT Avatar answered Oct 14 '25 08:10

Bright Ran-MSFT