Skip to content
Latchkey

.NET SDK "NETSDK1064: package X version Y was not found" in CI

NETSDK1064 fires at build time when the assets graph references a package/version that is not present in the restore output - it restored against a different graph than the build now expects, or the cached package directory is incomplete. It is a restore/build mismatch, not a missing-on-feed problem (that is NU1101/NU1102).

What this error means

The build fails with NETSDK1064 naming the package and version and suggesting it may have been deleted since restore. It often appears after a partial cache restore.

dotnet
error NETSDK1064: Package Serilog, version 4.0.0 was not found. It might have been deleted
since NuGet restore. Otherwise, NuGet restore might have only partially completed.

Common causes

Restore and build saw different package graphs

A version bump between the restore step and the build step, or a stale project.assets.json cached from a prior graph, leaves the build referencing a package the restore did not place.

The NuGet global-packages cache is incomplete

A partial or corrupted cache restore left the package directory missing the referenced version.

How to fix it

Force a clean, consistent restore

  1. Delete obj and re-run dotnet restore --force so assets match the current graph.
  2. Clear the NuGet cache if it may be partial: dotnet nuget locals all --clear.
  3. Rebuild so restore and build agree on versions.
shell
dotnet nuget locals all --clear
dotnet restore --force
dotnet build --no-restore -c Release

How to prevent it

  • Run restore and build in the same job with the same package versions.
  • Avoid caching obj; cache only the global-packages folder.

Frequently asked questions

What causes ""NETSDK1064: Package ... was not found""?
A version bump between the restore step and the build step, or a stale project.assets.json cached from a prior graph, leaves the build referencing a package the restore did not place.
How do I fix "NETSDK1064: Package ... was not found"?
Force a clean, consistent restore

Related guides

References

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