Skip to content
Latchkey

NuGet "NU1100: Unable to resolve" from Package Source Mapping

Package source mapping restricts which feed each package id may come from. If a package matches no <packageSourceMapping> pattern, NuGet allows it from no source and restore fails to resolve it - even though the feed has it.

What this error means

Restore fails to resolve a package (often NU1100) that you know exists on a configured feed. The cause is that source mapping does not route that id to any source, so NuGet never searches the feed that has it.

dotnet restore output
error NU1100: Unable to resolve 'Contoso.Internal.Auth (>= 2.0.0)' for 'net8.0'.
PackageSourceMapping is enabled, the following source(s) were not considered:
 nuget.org, internal

Common causes

No source-mapping pattern matches the package id

With source mapping enabled, a package must match a <package pattern="..."> under some source. An id outside every pattern is routed to no source and cannot be resolved.

A pattern routes the id to the wrong feed

A broad pattern (e.g. * under nuget.org) can capture an internal id and send it to a public feed that does not have it, so it never reaches the private feed.

How to fix it

Add a mapping pattern for the package

Route the package id (or its prefix) to the source that actually hosts it.

NuGet.config
<packageSourceMapping>
  <packageSource key="nuget.org">
    <package pattern="*" />
  </packageSource>
  <packageSource key="internal">
    <package pattern="Contoso.*" />
  </packageSource>
</packageSourceMapping>

Verify which source a package maps to

  1. Restore with --verbosity detailed to see which sources were considered for each id.
  2. Make internal prefixes map to the private feed and only public ids map to nuget.org.
  3. Re-run restore and confirm the package now resolves from the intended feed.

How to prevent it

  • Define explicit mapping patterns for internal package prefixes.
  • Keep * mapped to the public feed and specific prefixes to private feeds.
  • Treat source mapping as a security control against dependency confusion, not just routing.

Frequently asked questions

What causes "package source mapping no match"?
With source mapping enabled, a package must match a <package pattern="..."> under some source. An id outside every pattern is routed to no source and cannot be resolved.
How do I fix package source mapping no match?
Route the package id (or its prefix) to the source that actually hosts it.

Related guides

References

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