# .NET "error NETSDK1047: Assets file does not have a target for RID" in CI

> Fix "error NETSDK1047: Assets file does not have a target for net8.0/RID" during dotnet publish in CI - the project was restored without the runtime identifier it is now being published for.

Source: https://latchkey.dev/learn/dotnet/netsdk1047-assets-file-missing-rid-target-in-ci  
Updated: 2026-06-30

You are publishing for a runtime identifier (RID) that restore did not produce assets for. NETSDK1047 means `project.assets.json` has no target for the framework/RID pair, so you must restore with that RID first.

## Diagnose it: SDK version and restore first

Most .NET CI failures are an SDK mismatch or a restore that did not happen. `global.json` pins the SDK, and if the runner does not have that exact version the failure message is about the project rather than the SDK.

```Terminal
dotnet --info
cat global.json 2>/dev/null

# restore explicitly so a restore failure is not reported as a build failure
dotnet restore --verbosity normal
dotnet build --no-restore -warnaserror
```

> Pin the SDK with `global.json` and install exactly that version with `actions/setup-dotnet`. A floating SDK turns a runner image update into a build break on unchanged code.

## FAQ

### What causes .NET "error NETSDK1047: assets file does not have a target for RID" in CI?

There are 2 common causes: publish for a rid that restore did not cover and a cached restore from a prior, rid-less run. A framework-dependent restore produced no RID-specific assets, but publish requests -r linux-x64, so the assets file lacks that target.

### How do I fix .NET "error NETSDK1047: assets file does not have a target for RID" in CI?

There are 2 fixes depending on which cause you have: restore for the runtime identifier and declare runtimeidentifiers in the project. Work through them in order, since the first is the most common.

### What does .NET "error NETSDK1047: assets file does not have a target for RID" in CI actually mean?

dotnet publish fails with "error NETSDK1047: Assets file ".../project.assets.json" doesn't have a target for 'net8.0/linux-x64'.

### How do I stop .NET "error NETSDK1047: assets file does not have a target for RID" in CI happening again?

Restore with the same RID you publish for. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
