title: Environment Variable replacement in Nuget.config
body: <p>We have dotnet core application with Nuget.config file . As part of azure devops CI pipeline, we want to read and replace environment variables in Nuget.config file. Environment/Pipeline variables(USERNAME and PWD) are configured in "Build Docker Image" Task in CI pipeline. The azure devops CI build server runs on Ubuntu machine.</p>
  
  <p>Environment variables in MAC/Linux should be replaced in following way as per <a href="https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#example-config-file" rel="noreferrer">this</a> documentation.</p>
  
  <p>The syntax "$USERNAME" in Nuget.config is not working here. When we replace static username and password, it works fine.</p>
  
  <p>Nuget.config</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;packageSources&gt;
      &lt;add key="abcFeed" value="https://somedevops.com/xyz/packaging/someApps/nuget/v3/index.json" /&gt;
      &lt;add key="nuget.org" value="https://api.nuget.org/v3/index.json" /&gt;
    &lt;/packageSources&gt;
    &lt;packageSourceCredentials&gt;
      &lt;abcFeed&gt;
        &lt;add key="Username" value="$USERNAME"/&gt;
        &lt;add key="ClearTextPassword" value="$PWD"/&gt;
      &lt;/abcFeed&gt;
    &lt;/packageSourceCredentials&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>We have tried below syntax with following documentation, none of them are working: $USERNAME, $(USERNAME), %USERNAME%, $USERNAME$</p>
  
  <ul>
  <li><p><a href="https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#example-config-file" rel="noreferrer">https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file#example-config-file</a></p></li>
  <li><p><a href="https://intercom.help/appcenter/en/articles/2216043-restore-private-azuredevops-package-management-feeds-using-pat" rel="noreferrer">https://intercom.help/appcenter/en/articles/2216043-restore-private-azuredevops-package-management-feeds-using-pat</a>.</p></li>
  <li><p><a href="https://stackoverflow.com/questions/34318069/setting-an-environment-variable-in-a-nuget-config-file">Setting an environment variable in a NuGet.Config file</a></p></li>
  </ul>
  
  <p>What is correct syntax or way of replacing environment variables in Nuget.config file with azure devops pipeline? </p>