.NET SDK "NETSDK1004: assets file project.assets.json not found" in CI
By Daniel Zoghalchali·Latchkey
NETSDK1004 means the build needs obj/project.assets.json - the file restore writes to record resolved packages - and it is missing. In CI this is a build step that ran with --no-restore (or before restore) on a clean checkout where obj was never populated.
What this error means
The build fails with NETSDK1004 telling you to run a restore. It reproduces every run until restore happens first.
dotnet
error NETSDK1004: Assets file '/work/App/obj/project.assets.json' not found.
Run a NuGet package restore to generate this file.
Keep a dedicated restore step early in the pipeline.
Cache the NuGet package cache, not obj, and let restore regenerate assets.
Frequently asked questions
What causes .NET SDK "NETSDK1004: assets file project.assets.json not found" in CI?
There are 2 common causes: build ran with --no-restore but nothing restored first and obj was cleaned or not cached between steps. A dotnet build --no-restore or dotnet test --no-restore step runs on a clean checkout where no prior dotnet restore generated the assets file.
How do I fix .NET SDK "NETSDK1004: assets file project.assets.json not found" in CI?
Restore before building. Add an explicit dotnet restore step before any --no-restore build/test.
What does .NET SDK "NETSDK1004: assets file project.assets.json not found" in CI actually mean?
The build fails with NETSDK1004 telling you to run a restore.
How do I stop .NET SDK "NETSDK1004: assets file project.assets.json not found" in CI happening again?
Keep a dedicated restore step early in the pipeline. The prevention section lists 2 changes that keep it from recurring.