1
votes

I'm attempting to use VSTS as a private feed for some Nuget packages I have. Feed is setup OK and on a Windows machine I have it pushes correctly - i.e. I copy / paste the command from the VSTS window, put in the right package name and off we go. It prompts for my username / password and the package is uploaded. On a Mac I do the exact same thing without the .exe on the end of Nuget of course, it again prompts for my credentials and then instead of the success I was expecting I get 400 Bad Request. Every single time.

Nothing obviously different here that I can see. No idea what's lacking on the Mac to make it work (I have the latest possible version of nuget for Mac) and I'm lost. Any light you can shed would be much appreciated - thanks.

1
You could try different NuGet.exe versions from dist.nuget.org/index.html - not sure which version you are using. Mono currently ships with NuGet 2.12. There is an open issue on NuGet about this although it looks like a Mono bug - github.com/NuGet/Home/issues/3251Matt Ward
This is an open issue: github.com/NuGet/Home/issues/4093Alex Mullans
As Matt said, NuGet or Mono has a workaround or fix to enable this to work. Tracking that with github.com/nuget/home/issues/3251. There is a workaround: Create a nuget.config which contains PAT in current directory, and using dotnet.exe from dotnet core CLI v1.0 preview 3 or later -- “dotnet nuget push [package] --source [source] –api-key vsts” on mac.Rob Relyea

1 Answers

0
votes

I had the same problem and got it to work by using NuGet v3.3.0

  1. Add NuGet v3.3.0 from https://dist.nuget.org/win-x86-commandline/v3.3.0/nuget.exe to your repo.

  2. Add your source

mono nuget.exe sources add -name {SOURCE_NAME} -source "https://{ACCOUNT_NAME}.pkgs.visualstudio.com/_packaging/{FEED_NAME}/nuget/v3/index.json" -username {EMAIL} -password {TOKEN}

  1. Push the package

mono nuget.exe push package.1.0.0.nupkg -Source {SOURCE_NAME} -ApiKey VSTS