Skip to content
Latchkey

dotnet "NETSDK1112: RID-specific publish requires restore" in CI

A RID-specific publish needs the runtime pack for that RID restored first. When publish runs with --no-restore (or restore did not include the RID), the runtime pack is absent and NETSDK1112 stops the publish.

What this error means

Publish fails with NETSDK1112 saying the runtime pack for a RID was not downloaded, after a --no-restore publish or a restore that did not target the RID. Restoring with the RID first makes it pass.

dotnet publish output
error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Host.linux-x64 was not
downloaded. Try running a NuGet restore with the RuntimeIdentifier 'linux-x64'.

Common causes

Publish ran for a RID without restoring it

A dotnet publish -r linux-x64 --no-restore has no runtime pack because the prior restore did not include that RID, so the RID-specific assets are missing.

Restore targeted a different RID (or none)

A plain dotnet restore (RID-agnostic) does not pull RID-specific runtime packs, so a later RID-specific publish has nothing to use.

How to fix it

Restore for the RID before publishing

Run restore with the same RID, then publish with --no-restore.

Terminal
dotnet restore -r linux-x64
dotnet publish -c Release -r linux-x64 --self-contained true --no-restore

Or let publish restore implicitly

Drop --no-restore so publish restores the RID-specific packs itself.

Terminal
dotnet publish -c Release -r linux-x64 --self-contained true

How to prevent it

  • Match the restore RID to the publish RID, or let publish restore implicitly.
  • Declare RuntimeIdentifiers in the project so RID assets restore deterministically.
  • Avoid --no-restore on RID-specific publish unless a RID-aware restore ran first.

Frequently asked questions

What causes ""NETSDK1112: ... runtime pack ... not downloaded""?
A dotnet publish -r linux-x64 --no-restore has no runtime pack because the prior restore did not include that RID, so the RID-specific assets are missing.
How do I fix "NETSDK1112: ... runtime pack ... not downloaded"?
Run restore with the same RID, then publish with --no-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