dotnet restore "lists package X but multiple packages" in CI
The feed reported one package id in its index but then returned multiple entries that differ only by case or duplication. NuGet cannot pick a single canonical package, so restore fails on that source.
What this error means
restore fails with a message that the feed "lists package X" but multiple packages exist, typically when a private feed has both MyPackage and mypackage published.
error : The feed 'private [https://.../index.json]' lists package 'Contoso.Utils'
but multiple packages with different cases were found. Package ids must be unique per feed.Common causes
The feed has case-colliding package ids
Two uploads with ids differing only in case (Contoso.Utils and contoso.utils) coexist, and NuGet refuses to treat them as one package.
A duplicate registration on the feed
A feed re-index or a partial mirror left two registration entries for the same id, so the index is ambiguous.
How to fix it
Deduplicate the package on the feed
- Identify the colliding ids on the feed (differ only by case or duplication).
- Unlist or delete the incorrect variant so one canonical id remains.
- Re-run restore once the feed exposes a single entry.
Reference the canonical id consistently
Use one exact casing for the PackageReference id across the solution so restore does not straddle both variants.
<PackageReference Include="Contoso.Utils" Version="1.4.0" />How to prevent it
- Publish each package id with one consistent casing.
- Enforce id uniqueness on the private feed.
- Reference package ids with a single canonical casing across projects.