1
votes

I have a private NuGet feed on Team Services, previously Visual Studio Team Services. Had issues authenticating but reset my Team Services alternative credentials, cleared out stuff in my global config and used nuget sources add to add the source back in with credentials.

So I don't think this is an authentication issue now. The error has changed.

My command line:

NuGet.exe push BrandPortaCoreDistrib.1.2.4.0.nupkg -Source https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/Libraries/nuget/v3/index.json -Verbosity detailed

But I get this on screen:

WARNING: No API Key was provided and no API Key could be found for 'https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/'. To save an API Key for a source use the 'setApiKey' command.
Pushing BrandPortaCoreDistrib.1.2.4.0.nupkg to 'https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/'...
  PUT https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/
  Unauthorized https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/ 1043ms
Using credentials from config. UserName: [email protected]
  PUT https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/
  BadRequest https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/14e755d8-0994-4b9d-b607-a79928cc4597/nuget/v2/ 5054ms
System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
   at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__16.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
---> (Inner Exception #0) System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
   at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__16.MoveNext()<---

Key to it is the BadRequest in the middle of all that. There's no other status information, no error given to help.

The package version is not in the feed already.

I have previously pushed to this feed from this project using this nuspec and the nupkgs that I build so I've no clue why the world hates me today.

I'm using NuGet.exe 3.4.3.855 and I am the owner of the feed in Team Services.

Strange how the crap being spewed on screen all talks about a URL with v2 in it and yet my Team Services feed is v3.

1

1 Answers

6
votes

Add "-ApiKey VSTS" in your command:

NuGet.exe push BrandPortaCoreDistrib.1.2.4.0.nupkg -Source https://brand.pkgs.visualstudio.com/DefaultCollection/_packaging/Libraries/nuget/v3/index.json -Verbosity detailed -ApiKey VSTS