Pushing to private NuGet feed (VSTS) gives 400 BadRequest

629 views Asked by At

I'm having troubles pushing to VSTS while being on Linux. I've tried a lot of things like installing the NuGet Package (which is way outdated) on Linux (version 2.5.*). Since that didn't work i've installed mono and ran NuGet 3.5 and 4.0 to push to VSTS. And now i'm stuck with getting a bad request.

This is the command i use:

mono NuGet.exe push pack/package.nupkg -Source "TFS" -ApiKey VSTS

This is the nuget.config i'm using:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
    <add key="aspnet-contrib" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
    <add key="TFS" value="https://some.pkgs.visualstudio.com/_packaging/package/nuget/v3/index.json" />
  </packageSources>
  <activePackageSource>
      <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <packageSourceCredentials>
      <TFS>
        <add key="Username" value="[email protected]" />
        <add key="ClearTextPassword" value="somepassword" />
      </TFS>
  </packageSourceCredentials>
</configuration>

What is going on? If i'm setting Verbosity to detailed i'm getting the next stacktrace: http://pastebin.com/F5WfZpqN I've put it on PasteBin since it's a very long stacktrace.

Pushing from Windows using the exact same command and config is working. But since our CI is on GitLab and on a Linux machine running Debian Jessie we have to get it work on there.

1

There are 1 answers

0
Baklap4 On BEST ANSWER

I've made it working with uninstalling all mono-complete but keeping the dependencies for Debian. Then I removed the nuget.exe's from my project (nuget 3.5 and 4.0) and installed nuget with apt-get install nuget this nuget version is 2.12.0.0 as this is version 2 of nuget i've changed my config to the config below. Note the url of vsts ending with nuget/v2:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
    <add key="aspnet-contrib" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
    <add key="TFS" value="https://some.pkgs.visualstudio.com/_packaging/package/nuget/v2" />
  </packageSources>
  <activePackageSource>
      <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <packageSourceCredentials>
      <TFS>
        <add key="Username" value="[email protected]" />
        <add key="ClearTextPassword" value="somepassword" />
      </TFS>
  </packageSourceCredentials>
</configuration>

this setup worked locally and on my ci so i'm happy. I had a lot of help from this post: https://github.com/NuGet/Home/issues/3251