# Dotnet CI Workflow

> Pattern for .NET CI pipelines with Aspire projects in GitHub Actions Use when this capability is needed.

- Skill: `tomevault-io/dotnet-ci-workflow` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/dotnet-ci-workflow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/dotnet-ci-workflow/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/dotnet-ci-workflow

---


## Context
This project uses .NET 10, .NET Aspire (AppHost SDK via NuGet), and has the solution file at `src/AvnDataGenie.sln` with `global.json` in `src/`. CI workflows must account for this non-root solution layout.

## Patterns

### Working Directory
The solution and `global.json` live in `src/`, not the repo root. Set `defaults.run.working-directory: src` on the job to keep all `dotnet` commands scoped correctly.

### Aspire AppHost in CI
The AppHost uses `Aspire.AppHost.Sdk/X.Y.Z` as an MSBuild SDK (resolved via NuGet). It does NOT require the deprecated Aspire workload. It compiles in CI without Docker or container runtime — it only needs containers at runtime, not build time.

### NuGet Cache Key
Use `hashFiles('src/**/*.csproj', 'src/global.json')` to key the NuGet cache. This captures both package version changes and SDK version changes.

### Action Pinning
Always pin actions to full commit SHAs with a version comment:
```yaml
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
```

### Concurrency
Use `concurrency.cancel-in-progress: true` with a branch-scoped group to avoid wasted CI minutes on rapid pushes.

### Test Readiness
Wire up `dotnet test` even when no test projects exist. It succeeds with 0 tests and automatically picks up new test projects when added.

## Anti-Patterns
- **Installing Aspire workload in CI** — it's deprecated. The SDK resolves via NuGet.
- **Running CI on `windows-latest` without justification** — doubles cost, no signal for Linux-targeted containerized apps.
- **Unpinned action versions** — supply-chain risk. Always SHA-pin.
- **Missing `--no-restore` on build** — wastes time re-resolving packages after explicit restore step.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/carlfranklin) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

