Search code examples
azureazure-devopsazure-pipelines

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?


Solution

  • 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