推送到Visual Studio Team Services NuGet feed提供400 BadRequest

时间:2016-05-24 16:35:00

标签: nuget azure-devops

我在Team Services上有一个私有的NuGet提要,以前是Visual Studio Team Services。如果发现身份验证问题但重置了我的Team Services替代凭据,请清除我的全局配置中的内容,并使用nuget sources add将凭据添加回凭据。

所以我认为现在这不是一个身份验证问题。错误已经改变。

我的命令行:

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

但是我在屏幕上看到了这个:

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: something@domain.com
  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()<---

关键是BadRequest在所有这些中间。没有其他状态信息,没有给出帮助的错误。

包版本不在Feed中。

我之前已经使用这个nuspec和我构建的nupkgs从这个项目推送到这个feed,所以我不知道为什么世界今天讨厌我。

我正在使用NuGet.exe 3.4.3.855,我是团队服务中Feed的所有者。

奇怪的是,屏幕上出现的垃圾是如何在其中讨论带有v2的URL,但我的团队服务提要是v3。

1 个答案:

答案 0 :(得分:6)

在命令中添加“-ApiKey VSTS”:

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