Nuget deploy task failing

Darren Neimke's Avatar

Darren Neimke

Oct 28, 2017 @ 09:40 PM

My build fails with the following message:

"Error publishing package. NuGet server returned 401: An API key must be provided in the 'X-NuGet-ApiKey' header to use this service"

And here is a link to the build.

https://ci.appveyor.com/project/dneimke/code-timer/build/0.0.42

I am able to deploy when using the following deploy_script:

deploy_script:
 - appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
 - ps: .\nuget.exe setApiKey $env:nuget_apikey -source https://www.nuget.org | out-null
 - ps: ($artifacts.values | Where-Object { $_.path -like '*.nupkg' }) | foreach-object {nuget.exe push $_.path -Source https://www.nuget.org/api/v2/package}

But when I try to use the following deploy task, it fails:

deploy:
- provider: NuGet
  api_key:
    secure: $env:nuget_apikey
  skip_symbols: true
  1. Support Staff 1 Posted by Feodor Fitsner on Oct 28, 2017 @ 09:53 PM

    Feodor Fitsner's Avatar

    Try modifying deploy section like:

    deploy:
    - provider: NuGet
      api_key: $(nuget_apikey)
      skip_symbols: true
    
  2. 2 Posted by Darren Neimke on Oct 28, 2017 @ 11:07 PM

    Darren Neimke's Avatar

    Thanks, that fixed it.

  3. Ilya Finkelshteyn closed this discussion on Aug 25, 2018 @ 02:20 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac