aspire-orchestration

**WORKFLOW SKILL** — Manage Aspire AppHost lifecycle and recover from file locks, port conflicts, and orphaned processes. WHEN: "start my Aspire app", "aspire…

npx skills add https://github.com/microsoft/aspire-skills --skill aspire-orchestration

Aspire Orchestration

MANDATORY COMPLIANCE — This skill prevents agent self-harm in Aspire projects. Violating these rules causes file locks, orphaned processes, and user frustration (#15801).

Prerequisites

RequirementInstall
.NET 10.0 SDKhttps://dotnet.microsoft.com/download
Aspire CLI (curl/PowerShell)curl -sSL https://aspire.dev/install.sh | bash
Aspire CLI (NativeAOT global tool, .NET 10)dotnet tool install -g Aspire.Cli

Either install method works. The dotnet tool install path produces a NativeAOT binary (instant startup, no JIT warmup) and is the recommended option when .NET 10 is already present.

Detection

Activate when ANY signal is present:

SignalHow to DetectConfidence
C# AppHost.csproj containing Aspire.AppHost.Sdk✅ Definitive
File-based C# AppHostapphost.cs or .cs file with #:sdk Aspire.AppHost.Sdk✅ Definitive
TypeScript AppHostapphost.ts file in project✅ Definitive
Aspire configaspire.config.json in project rootHigh
Aspire settings.aspire/ directory presentHigh
Generated TS modules.aspire/modules/ directory presentHigh
Service defaultsAspire.ServiceDefaults in project referencesMedium

See detection.md for detailed fingerprinting.

Safety Guardrails

Situation✅ ALWAYS Do❌ NEVER Do
Start an Aspire appaspire startdotnet run on AppHost
Wait for resource readyaspire wait <resource>curl / HTTP polling loops
Code changed in a resourcePrefer resource commands, runtime watch/HMR, dashboard actions, or IDE-managed debuggingdotnet build against locked files
Task completeaspire stopLeave processes running
Check resource statusaspire describe / aspire psManual process inspection
Working in git worktreeaspire start --isolatedaspire start without isolation
Running from AI agentAdd --non-interactive to all commandsAssuming interactive terminal
Editing unfamiliar APIaspire docs search <topic> then aspire docs api search <query> for API referenceGuessing API shape
C# AppHost API inspectionUse dotnet-inspect skill (if available) for local symbolsGuessing overloads or builder chains
Adding custom dashboard/resource commandsaspire docs search "custom resource commands" firstInventing WithCommand patterns without docs
Installing Aspire supportUse aspire add or aspire initdotnet workload install aspire (obsolete)

See safety-guardrails.md for detailed rules and recovery patterns.

Default Workflow

  1. Confirm workspace is Aspire — identify the AppHost
  2. aspire start (or aspire start --isolated in worktrees)
  3. aspire wait <resource> before interacting with any resource
  4. aspire describe to inspect state, then work
  5. If AppHost code changed, rerun aspire start; if only one resource changed, prefer the resource's commands/watch/HMR/debug workflow
  6. aspire stop when cleanup is explicitly requested or needed to release locks/ports

Quick Reference

TaskCommand
Start app (agents)aspire start (background, preferred)
Start app (human)aspire run (foreground, dashboard)
Stop appaspire stop
Wait for resourceaspire wait <resource>
Check statusaspire ps or aspire describe
Show hidden resources (proxies, helpers, migrations)aspire ps --include-hidden / aspire describe --include-hidden
Resource operationaspire resource <resource-name> <command> such as stop, start, or rebuild when exposed
Create new projectaspire new aspire-starter
Add Aspire to existingaspire init (then hand off to aspireify skill for wiring)
Add integrationaspire add <package>
Discover integrationsaspire integration list --format Json / aspire integration search <query> --format Json
Upgrade the CLI itselfaspire update --self
Update project package refsaspire update (modifies project files — get user approval)
Restore generated filesaspire restore
Environment maintenanceaspire cache clear, aspire certs trust, aspire certs clean
Diagnose environmentaspire doctor
Machine-readable output--format Json (supported: ps, describe, start)
Look up API referenceaspire docs api search <query> --language csharp|typescript
Browse API entriesaspire docs api list <scope>
Get API detailaspire docs api get <id>

Error Handling

SymptomCauseAction
File lock errors during build (MSB3491, CS2012)Aspire is running and holds locks on bin/, obj/, and assemblies.Run aspire stop first, then rebuild or aspire start. Do NOT conclude the project has a permanent build failure.
"Port already in use"Previous instance runningaspire stop, then aspire start
Resource not foundApp not started or name wrongaspire ps to check
Build errors in resourceCode error, not Aspire issueFix code, then use resource commands/watch/HMR/debug workflow or rerun aspire start if AppHost code changed
Environment issuesMissing SDK or toolsaspire doctor to diagnose
JSON parse failure from aspire startMixed human/JSON output (#15843)Strip non-JSON lines before parsing
aspire wait rejects nameUse displayName not name (#15842)Use displayName from aspire ps --format Json
aspire ps hangsAppHost on breakpoint (#15576)Use timeout, check AppHost process
aspire agent init failsNon-interactive terminal (#16264)Run from standard terminal
Docker daemon unavailableContainer-backed resources fail to startStart Docker Desktop, then aspire start
Multiple AppHosts detectedWrong AppHost targetedUse --apphost <path> to specify explicitly

🔒 File-Lock Recovery (MSB3491 / CS2012) — Always aspire stop First

When a build fails with error MSB3491: Could not write to output file ... or error CS2012: Cannot open ... for writing, the project itself is healthy — Aspire is running and holding file locks on the resource's output assemblies. The recovery is always the same:

# ✅ Correct recovery sequence
aspire stop              # release the locks
# ... then either rebuild / restart one resource if the resource exposes commands ...
aspire resource <name> rebuild   # example: C# project resource with rebuild command
# ... or restart the whole AppHost ...
aspire start             # if AppHost code changed or Aspire was already stopped
❌ NEVER do✅ ALWAYS do
Tell the user the project has a permanent build failureRecognize the lock as Aspire holding outputs and run aspire stop
dotnet build again with locks heldaspire stop first, then dotnet build (or prefer resource commands/watch/HMR/debug workflow)
Delete bin/ / obj/ to "fix" the lockaspire stop — deletion may succeed but the next build relocks
pkill dotnet or kill <PID> to free locksaspire stop — clean shutdown via the CLI, no orphans
Tell the user to "reboot" or "restart your machine"aspire stop — single command, instant fix

The same rule applies to any "file in use", "cannot access the file", or "another process is using" error during a build of an Aspire-managed resource.

Handoff Rules

ScenarioRoute To
AppHost wiring after aspire init (scan repo, add resources, ServiceDefaults/OTel)aspireify skill (aspireify/SKILL.md) or project-local .agents/skills/aspireify/SKILL.md
Browser logs (Aspire.Hosting.Browsers / WithBrowserLogs()) and dashboard authoringaspireify skill (code edits) and aspire-monitoring (discovery)
Custom resource commands (WithCommand, ExecuteCommandResult, HttpCommandResultMode)aspireify skill
Lifecycle hooks (SubscribeBeforeStart, SubscribeAfterResourcesCreated, BeforeStart pipeline phase)aspireify skill
Endpoint authoring (WithEndpoint updates, ExcludeReferenceEndpoint flag)aspireify skill
Deploy, publish, pipeline steps, aspire destroyaspire-deployment skill
Logs, traces, metrics, dashboard, aspire dashboard runaspire-monitoring skill
Deployed app diagnosticsazure-diagnostics skill (azure-skills)

Runtime Settings And Environment

VariableDefaultPurpose
ASPIRE_ENABLE_CONTAINER_TUNNELtrueContainer tunnel provides uniform host connectivity across Docker Desktop, Docker Engine, and Podman. Set to false to opt out.
ASPIRE_ENVIRONMENTunsetSelects the environment-specific config profile — controls which appsettings.{environment}.json is loaded and which environment is reported in dashboard telemetry.
ASPIRE_DCP_USE_DEVELOPER_CERTIFICATEtrueThe Aspire trusted developer certificate is used by DCP on Windows. Set to false to opt out.
features.defaultWatchEnabledfalse unless configuredEnables Aspire default watch for supported C# and TypeScript AppHosts. Do not treat this as per-resource rebuild, restart, or hot reload for resource source changes.

TypeScript AppHost Note

Detection covers TS AppHosts (apphost.ts), but all TS AppHost authoring is delegated to aspireify. Current rules to apply when handing off:

RuleWhy
Prefer unified withEnvironment(name, value) over deprecated per-kind helpers (withEnvironmentEndpoint, withEnvironmentParameter, withEnvironmentConnectionString, withEnvironmentExpression, withEnvironmentFromOutput, withEnvironmentFromKeyVaultSecret)Per-kind helpers are deprecated — single API now handles all value types
Never edit .aspire/modules/ directlyGenerated; use aspire add <package> to regenerate and aspire restore to recover missing files
Use aspire docs api search <query> --language typescript for API lookupTS surface differs from C#

Skill Routing — In-Plugin Sibling Skills

After aspire init drops a skeleton AppHost + aspire.config.json, route AppHost wiring (scan repo → propose resource graph → edit AppHost → wire Aspire.ServiceDefaults / OTel → validate via aspire start) to the in-plugin aspireify skill: aspireify/SKILL.md. For first-run flows that only need the skeleton drop, see the in-plugin aspire-init skill: aspire-init/SKILL.md. This orchestration skill stays focused on lifecycle (start/stop/wait/restart) and never edits AppHost code itself.

Project-Local Skill Precedence

If .agents/skills/aspire/SKILL.md exists (from aspire agent init), defer to it for: C# AppHost editing, TS AppHost editing, Playwright handoff, investigation workflows. Safety guardrails from this plugin ALWAYS apply.

If .agents/skills/aspireify/SKILL.md exists project-locally (installed by aspire init in current Aspire), warn the user that a project-local aspireify skill is present and defer to it for AppHost wiring instead of the in-plugin sibling. Same precedence rule as the project-local aspire skill above: project-local wins, plugin guardrails still apply.

References