--- name: aspire-cli description: Guidance for using the .NET Aspire CLI to create, initialize, run, update, publish, deploy, and manage Aspire AppHost projects. Use when selecting or explaining Aspire CLI commands, flags, or workflows (new/init/run/add/update/publish/deploy/do/exec/config/cache/mcp), or when upgrading to Aspire 13.1 CLI behaviors. MCP commands (aspire mcp init) are included when explicitly requested. metadata: version: 1.6.0 author: arisng --- # Aspire CLI Use this skill to pick the right Aspire CLI command, outline the workflow, and provide concise command guidance. Keep answers focused on non-MCP CLI features. ## Quick workflow 1. Identify the user goal (create, initialize, run, update, publish, deploy, execute step, run resource command, configure CLI, clear cache). 2. Determine the working directory (solution root vs AppHost folder) and whether an AppHost already exists. 3. Select the matching command from the CLI reference. 4. Call out required context (AppHost location, channel selection, SDK requirements). 5. Provide minimal example commands and flags. 6. Mention any Aspire 13.1 CLI behavior changes that affect the request. ## Incremental adoption workflow (adding Aspire to existing apps or Aspirify an existing app) Use this 5-step pattern when helping users adopt Aspire in existing applications: 1. **Initialize Aspire support** → `aspire init` - Interactive mode by default - Analyzes solution structure and suggests projects to add - Creates `{SolutionName}.AppHost/` project with `AppHost.cs` - May offer to add ServiceDefaults project 2. **Add applications to AppHost** → Edit `AppHost.cs` - Use `AddProject("resource-name")` - Chain `.WithHttpHealthCheck("/health")` for health monitoring - Chain `.WithReference(dependency)` for service-to-service communication - Chain `.WaitFor(dependency)` for startup ordering 3. **Configure telemetry** (optional) → `dotnet new aspire-servicedefaults` - Creates ServiceDefaults project for observability, resilience, health checks - Reference from service projects - Add `builder.AddServiceDefaults()` and `app.MapDefaultEndpoints()` in Program.cs 4. **Add integrations** (optional) → `aspire add ` - Adds hosting packages (Redis, PostgreSQL, etc.) - Configure in AppHost with `.WithReference(integration)` 5. **Run and verify** → `aspire run` - Builds AppHost/resources, starts dashboard - Dashboard URL appears in terminal output - Verify resources, logs, traces in dashboard ## Command selection (decision guide) - New project from templates → `aspire new` - Add Aspire to existing solution → `aspire init` - Run dev orchestration and dashboard → `aspire run` - Add official integration package → `aspire add` - Update Aspire NuGet packages → `aspire update` - Update CLI itself → `aspire update --self` - Publish deployment assets → `aspire publish` - Deploy serialized assets → `aspire deploy` - Run a pipeline step only → `aspire do ` - Run a tool inside a resource context → `aspire exec --resource -- ` - Configure CLI settings → `aspire config` - Clear cache → `aspire cache clear` - Initialize MCP for AI coding agents → `aspire mcp init` (configures VS Code, GitHub Copilot CLI, Claude Code, Open Code) ## Context checklist - Confirm .NET SDK 10.0.100+ is installed when using Aspire 13.x CLI. - Verify current directory contains or is under an AppHost when using `aspire run`, `aspire do`, `aspire exec`, `aspire publish`, or `aspire deploy`. - When multiple AppHosts exist, tell the user to run commands from the intended AppHost folder. - If the user mentions “preview/stable” selection, use `--channel` on `aspire new` or `aspire init`, and note channel persistence after `aspire update --self`. - When running multiple AppHost instances in parallel (worktrees/branches, multi-agent workflows), use isolation patterns from [aspire-isolation.md](references/aspire-isolation.md): management scripts for port allocation, portless endpoints, and worktree-specific dashboard naming. ## Actionable command patterns - Create a new project (interactive-first): `aspire new` - Create with a specific template: `aspire new