Skip to content
Latchkey

.NET SDK "NETSDK1004: assets file project.assets.json not found" in CI

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.

Diagnose it: SDK version and restore

Terminal
dotnet --info
cat global.json 2>/dev/null
dotnet restore --verbosity normal
dotnet build --no-restore

Common causes

Build ran with --no-restore but nothing restored first

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.

obj was cleaned or not cached between steps

A clean step or a cache miss removed obj, so the assets file from a previous step is gone.

How to fix it

Restore before building

  1. Add an explicit dotnet restore step before any --no-restore build/test.
  2. Or drop --no-restore so the build restores implicitly.
  3. Ensure obj is regenerated (or cached) before the consuming step, then re-run.
workflow
- run: dotnet restore
- run: dotnet build --no-restore -c Release

How to prevent it

  • 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.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card