Skip to content
Latchkey

NuGet "NuGet.config not found" or wrong config in CI

If nuget.config is not committed or the restore uses the wrong config file, the runner only knows about nuget.org. Private feeds and credentials defined only in a local, uncommitted config are invisible in CI.

What this error means

restore that works locally fails in CI with NU1101/NU1301 for private packages, because the nuget.config defining the feed exists only on a developer machine.

dotnet
error NU1101: Unable to find package Contoso.Internal. No packages exist with this id
      in source(s): nuget.org

Common causes

nuget.config is gitignored or never committed

The config defining the private feed lives locally and is not in the repo, so the runner restores with defaults only.

Restore points at the wrong config

A --configfile argument or a config in an unexpected directory means the feed and credential entries you expect are not loaded.

How to fix it

Commit a nuget.config with the required sources

  1. Create a repo-root nuget.config listing every feed the solution needs.
  2. Commit it (with credential placeholders, not secrets).
  3. Fill credentials from CI secrets at restore time.
nuget.config
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="private" value="https://pkgs.internal.example.com/nuget/v3/index.json" />
  </packageSources>
</configuration>

Point restore at the right config explicitly

If multiple configs exist, pass the intended one so the correct sources load.

Terminal
dotnet restore --configfile ./nuget.config

How to prevent it

  • Commit nuget.config so CI and local restores match.
  • Do not gitignore the config that defines shared feeds.
  • Keep secrets out of the committed config; inject them in CI.

Frequently asked questions

What causes ""NuGet.config not found""?
The config defining the private feed lives locally and is not in the repo, so the runner restores with defaults only.
How do I fix "NuGet.config not found"?
Commit a nuget.config with the required sources

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card