Error Knowledge Base .NET NETSDK1004

NETSDK1004: Assets file not found

The build cannot find project.assets.json from the restore step, so package resolution data is missing for the current project.

What Broke in the Dependency Graph

The build cannot find project.assets.json from the restore step, so package resolution data is missing for the current project.

Repair the dependency graph

Run dotnet restore and fix any NUxxxx errors first, avoid splitting restore and build across ephemeral workspaces, or remove --no-restore, and clean then retry with dotnet clean, then dotnet restore, then dotnet build.

Validation

Re-run the failing command and confirm the original code/message is gone, and confirm expected artifacts or outputs exist (packages restored, build/publish succeeds).

Why Resolution Broke

Usually this comes down to the restore step is missing or failed earlier, often due to a NUxxxx error, CI stages don’t share obj/ between restore and build, or --no-restore was used before dependencies were restored.

Prove the Graph Is Clean Again

obj/project.assets.json exists after restore.

dotnet build succeeds without NETSDK1004.

Typical Output

error NETSDK1004: Assets file 'obj/project.assets.json' not found. Run a NuGet package restore to generate this file.

Mechanism

This is the part worth understanding if the quick fix did not hold. It explains what .NET is trying to do at the moment the error appears.

dotnet build consumes obj/project.assets.json generated by restore.

If restore didn’t run, failed, or its outputs were cleaned, NETSDK1004 is emitted.

Keep the Dependency Graph Healthy

To prevent this, fail CI on restore failure instead of continuing to build, and cache NuGet global packages, not obj/ directories, across CI legs.

Docs and source code

NETSDK1004 message template

User-facing message template. - GitHub

  <data name="AssetsFileNotFound" xml:space="preserve">
    <value>NETSDK1004: Assets file '{0}' not found. Run a NuGet package restore to generate this file.</value>
    <comment>{StrBegins="NETSDK1004: "}</comment>
  </data>

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list