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.
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.
dotnet restore -r linux-x64
dotnet publish -c Release -r linux-x64 --self-contained true --no-restoreOr let publish restore implicitly
Drop --no-restore so publish restores the RID-specific packs itself.
dotnet publish -c Release -r linux-x64 --self-contained trueHow to prevent it
- Match the restore RID to the publish RID, or let publish restore implicitly.
- Declare
RuntimeIdentifiersin the project so RID assets restore deterministically. - Avoid
--no-restoreon RID-specific publish unless a RID-aware restore ran first.