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.
error NU1101: Unable to find package Contoso.Internal. No packages exist with this id
in source(s): nuget.orgCommon 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
- Create a repo-root
nuget.configlisting every feed the solution needs. - Commit it (with credential placeholders, not secrets).
- Fill credentials from CI secrets at restore time.
<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.
dotnet restore --configfile ./nuget.configHow to prevent it
- Commit
nuget.configso 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.