title: Dot net test fails to restore EnterpriseLibrary.Logging Nuget in Azure DevOps
body: <p>My AzureDevOps YML Looks like this:</p>
  <pre><code>- task: NuGetCommand@2
        displayName: &quot;Restore Test Solution&quot;
        inputs:
          restoreSolution: $(Build.SourcesDirectory)\TestSln\*.sln
          feedsToUse: config
          nugetConfigPath: NuGet.config
          allowPackageConflicts: true
          includeNuGetOrg: true
  
      - task: VSBuild@1
        displayName: 'Build Test Solution'
        inputs:
          solution: $(Build.SourcesDirectory)\TestSln\*.sln
          platform: x64
          configuration: $(buildConfiguration)
          clean: false
  
      - task: DotNetCoreCLI@2
        inputs:
          command: 'test'
          projects: |
            $(Build.SourcesDirectory)\TestSln\**\*.csproj
          arguments: '--filter TestCategory=RunOnServerBuild'
          testRunTitle: 'TestSln Dot Net Test'
  </code></pre>
  <p>EnterpriseLibrary.Logging is Nuget Package hosted at nuget.org : <a href="https://www.nuget.org/packages/EnterpriseLibrary.Logging/" rel="nofollow noreferrer">https://www.nuget.org/packages/EnterpriseLibrary.Logging/</a></p>
  <p>My Nuget.config that is used by azure dev ops does have the entry:</p>
  <p><strong>Restore Solution works fine:</strong></p>
  <pre><code>2021-08-19T13:43:51.5771525Z WARNING: NU1603: EnterpriseLibrary.Logging 6.0.1304 depends on EnterpriseLibrary.Common (&gt;= 6.0.0) but EnterpriseLibrary.Common 6.0.0 was not found. An approximate best match of EnterpriseLibrary.Common 6.0.1304 was resolved.
  </code></pre>
  <p><strong>Build Works fine</strong></p>
  <p>During Dot Net Test run , when it's trying to restore .Net Core 3.1 Tests, it fails to restore the same library from nuget.org. it's trying to access other private feeds and fails with 401 unauthorized error</p>
  <p><strong>---  : hiding our domain for privacy purposes.</strong></p>
  <pre><code>2021-08-19T13:45:58.9657200Z   Restored D:\a\1\s\TestSln\SomeProject\SomeProject.csproj (in 609 ms).
  2021-08-19T13:45:58.9658040Z   Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/---/_packaging/428bdd6d-11e8-4a49-b9c9-63fec137af86/nuget/v3/flat2/enterpriselibrary.common/index.json'.
  2021-08-19T13:45:58.9659145Z   Response status code does not indicate success: 401 (Unauthorized).
  2021-08-19T13:45:58.9660077Z   Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/---/_packaging/428bdd6d-11e8-4a49-b9c9-63fec137af86/nuget/v3/flat2/enterpriselibrary.common/index.json'.
  2021-08-19T13:45:58.9661165Z   Response status code does not indicate success: 401 (Unauthorized).
  2021-08-19T13:45:58.9662152Z C:\Program Files\dotnet\sdk\5.0.400\NuGet.targets(131,5): error : Failed to retrieve information about 'EnterpriseLibrary.Common' from remote source 'https://pkgs.dev.azure.com/---/_packaging/428bdd6d-11e8-4a49-b9c9-63fec137af86/nuget/v3/flat2/enterpriselibrary.common/index.json'. [D:\a\1\s\TestSln\SomeProject\SomeProject.csproj]
  2021-08-19T13:45:58.9664792Z C:\Program Files\dotnet\sdk\5.0.400\NuGet.targets(131,5): error :   Response status code does not indicate success: 401 (Unauthorized). [D:\a\1\s\TestSln\SomeProject\SomeProject.csproj]
  2021-08-19T13:45:59.0226475Z ##[debug]Exit code 1 received from tool 'C:\Program Files\dotnet\dotnet.exe'
  2021-08-19T13:45:59.0444559Z ##[debug]STDIO streams have closed for tool 'C:\Program Files\dotnet\dotnet.exe'
  2021-08-19T13:45:59.0458377Z ##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
  2021-08-19T13:45:59.0459252Z ##[debug]Processed: ##vso[task.issue type=error;]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
  </code></pre>
  <p>My Nuget.config that is used to restore solution contains link to nuget json</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;packageRestore&gt;
          &lt;!-- Allow NuGet to download missing packages --&gt;
          &lt;add key=&quot;enabled&quot; value=&quot;True&quot; /&gt;
  
          &lt;!-- Automatically check for missing packages during build in Visual Studio --&gt;
          &lt;add key=&quot;automatic&quot; value=&quot;True&quot; /&gt;
      &lt;/packageRestore&gt;
       
      &lt;packageSources&gt;
          &lt;add key=&quot;nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; /&gt;
          &lt;add key=&quot;PrivateFeed1&quot; value=&quot;https://pkgs.dev.azure.com/---/_packaging/PrivateFeed1/nuget/v3/index.json&quot; /&gt;
      &lt;add key=&quot;PrivateFeed2&quot; value=&quot;https://pkgs.dev.azure.com/---/_packaging/PrivateFeed2/nuget/v3/index.json&quot; /&gt;
      &lt;/packageSources&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>even in debug mode, during dotnet test run ,it never shows it tried to access nuget.org to restore Enterpriselibrary.common</p>
  <p>Please help, i have tried almost all the solutions but the test project still fails</p>
  <p>thanks</p>