broersa
broersa

Reputation: 1736

dotnet restore NuGet.Config environment variables for ClearTextPassword doesn't work

To do CI I'd like to checkin a NuGet.Config file with my own nuget feed (an VSTS one). Like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="myfeed" value="https://xxx.pkgs.visualstudio.com/_packaging/myfeed/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <myfeed>
        <add key="ClearTextPassword" value="%PASSWD%" />
    </myfeed>
  </packageSourceCredentials>
</configuration>

Because I don't want to check in the password, I read you can use Environment Variables in this configuration. I tried it and it works in the PackageSources value. But it seems it doesn't work in the PackageSourceCredentials like shown above. Does someone has a solution for this?

Upvotes: 3

Views: 2002

Answers (1)

broersa
broersa

Reputation: 1736

I had to add the key Username to the PackageSourceCredentials. I thought it was of no use. But it cached the first time I removed it and later I added the env var and after this it broke.

Upvotes: 4

Related Questions