aspire init command
aspire init - Initialize Aspire support in an existing codebase with a C#, TypeScript, or Go AppHost.
Synopsis
Section titled “Synopsis”aspire init [options]Description
Section titled “Description”The aspire init command scaffolds a minimal AppHost and aspire.config.json in an existing codebase. It can then edit AI agent settings to enable plugins and skill catalogs. The default Aspire plugin includes aspireify, which guides your agent through wiring the app.
This command defaults to interactive mode. When executed without any options, the command prompts you for the AppHost language when more than one path is available.
AppHost detection
Section titled “AppHost detection”The command adapts to the repo it finds:
- C# file-based AppHost (when selected interactively) — creates
apphost.cswith#:packagedirectives for a lightweight single-file orchestrator. - TypeScript AppHost (when selected interactively) — creates
apphost.mtswith the generated.aspire/modules/folder. If the repo already has a rootpackage.json, the AppHost is created as a nestedaspire-apphost/package and the rootaspire.config.jsonpoints toaspire-apphost/apphost.mts. - Go AppHost (when selected interactively): creates
apphost.go, ago.modthat points at the generated SDK, and the generated.aspire/modules/folder. If the repo already has a rootgo.mod, the AppHost is created as a separateaspire-apphost/module with its owngo.workfile, and the rootaspire.config.jsonpoints toaspire-apphost/apphost.go. Your existinggo.mod,go.work, and source files aren’t changed.
In all cases, the AppHost language does not limit what you can orchestrate — C#, JavaScript, Python, Go, Rust, Java, containers, and more can all be modeled in the same application model.
Default hosting packages
Section titled “Default hosting packages”For non-C# AppHosts, aspire init records the hosting package for your language in the AppHost aspire.config.json, so you can use its resource APIs without running aspire add first. The packages are restored and code generated together with the language support package, using the AppHost’s effective SDK version, which falls back to the CLI’s SDK version when none is configured. An entry that already exists in aspire.config.json is kept.
| Language | Default hosting packages |
|---|---|
| TypeScript | Aspire.Hosting.JavaScript |
| Python | Aspire.Hosting.Python |
| Go | Aspire.Hosting.Go |
| Java, Rust | None because Aspire.Hosting.Java and Aspire.Hosting.Rust are in preview. When these packages ship stable versions, aspire init will list them. |
File-based C# AppHosts reference their packages with #:package directives instead. Project-based C# AppHosts use PackageReference items in the project file. An empty AppHost created with aspire new gets the same defaults.
Skipping solution discovery with —file-based
Section titled “Skipping solution discovery with —file-based”Repositories can contain incidental .sln or .slnx files that aren’t meant to back the AppHost — they cause aspire init to prompt for a solution or scaffold a project-based AppHost even when you only want a minimal, file-based AppHost at the repository root.
Pass --file-based to bypass .NET solution discovery entirely and always create the single-file apphost.cs scaffold in the current directory, regardless of any .sln or .slnx files present.
--file-based requires C#. If another language is selected — explicitly with --language, through existing aspire.config.json configuration, or at the interactive language prompt — the command fails with an error before scaffolding or persisting the language selection. Omitting --file-based (or passing --file-based false) preserves normal initialization for all languages. Existing-file protection and agent skill setup are unaffected by this option.
aspire init --file-based --language csharpChannel persistence in aspire.config.json
Section titled “Channel persistence in aspire.config.json”When aspire init runs with an explicit, non-stable channel (such as daily or staging), it writes a top-level channel key into the generated aspire.config.json. This ensures that subsequent commands — aspire add, aspire update, and others — resolve packages and templates against the same channel the project was initialized with, rather than falling back to the implicit stable default.
For example, running a daily CLI build produces:
{ "appHost": { "path": "apphost.cs" }, "channel": "daily", "profiles": { "https": { "applicationUrl": "https://localhost:17055;http://localhost:15013", "environmentVariables": { "ASPIRE_DASHBOARD_OTLP_GRPC_ENDPOINT_URL": "https://localhost:16168", "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22043" } }, "http": { "applicationUrl": "http://localhost:15013", "environmentVariables": { "ASPIRE_DASHBOARD_OTLP_GRPC_ENDPOINT_URL": "http://localhost:19147", "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20216", "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" } } }}If aspire.config.json already contains a channel value (for example, because you edited it manually or migrated from an older project), the value is preserved and not overwritten.
Only channels that are registered as explicit in the packaging service are persisted, with one exception: the stable channel is treated as the portable default and is intentionally not pinned.
The aspireify skill
Section titled “The aspireify skill”After scaffolding, aspire init uses the aspire agent init setup flow to edit agent settings. The built-in Aspire source provides aspireify to guide resource wiring. Your skillSources configuration can add other sources or exclude the built-in source.
The skill instructs the agent to:
- Scan the repo and discover existing projects, services, and containers
- Ask you clarifying questions before making decisions — for example, which services to orchestrate, whether a hardcoded port is significant, or whether to map an existing env var or switch to Aspire’s service discovery
- Wire resources into the AppHost with
WithReferencewithReferenceWithReference,WaitForwaitForWaitFor, endpoints, and volumes - Optionally configure OpenTelemetry
- Validate the wiring with a smoke-test
aspire start
Options
Section titled “Options”The following options are available:
-
--languageThe AppHost language to scaffold (
csharp,typescript,go). -
--file-basedCreate
apphost.csin the current directory, skipping .NET solution discovery. Requires C#: fails with an error if another language is selected explicitly, via configuration, or at the language prompt. -
--use-config-source [true|false]Choose whether to apply an offered configuration source when initializing the app. Pass
--use-config-sourceor--use-config-source trueto accept, or--use-config-source falseto decline and save an app-local opt-out.If a source is available, interactive initialization prompts when this option is omitted; non-interactive initialization requires an explicit choice. Requesting acceptance when no source is available is an error. An existing app-local source binding or opt-out is preserved.
-
--agents <agents>Comma-separated agent IDs:
copilot,claude, oropencode. Useallto configure all supported agents ornoneto skip agent configuration. For selection defaults, see theaspire agent initcommand reference. -
--scope <project|global>Write agent configuration and companion skill files at project or user scope. Non-interactive setup defaults to
project. -
--skills <skills>Comma-separated choices:
aspire,playwright-cli, ordotnet-inspect. Useallfor every applicable choice ornoneto skip them. Defaults toaspire, which applies all enabled skill sources. For details, see theaspire agent initcommand reference. -
-?, -h, --helpPrints help and usage documentation for the available commands and options.
-
-l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.
-
--non-interactiveRun the command in non-interactive mode, disabling all interactive prompts and spinners.
-
--nologoSuppress the startup banner and telemetry notice.
-
--bannerDisplay the animated Aspire CLI welcome banner.
-
--wait-for-debuggerWait for a debugger to attach before running a command.
Examples
Section titled “Examples”-
Initialize Aspire support in the current repo interactively:
Aspire CLI aspire init -
Initialize Aspire support with a TypeScript AppHost:
Aspire CLI aspire init --language typescript -
Initialize Aspire support with a Go AppHost:
Aspire CLI aspire init --language go -
Initialize an empty C# AppHost at the repository root, ignoring any incidental
.slnor.slnxfiles:Aspire CLI aspire init --file-based --language csharp -
Initialize Aspire support non-interactively without configuring agents:
Aspire CLI aspire init --non-interactive --agents none -
Initialize Aspire support non-interactively and decline an available configuration source:
Aspire CLI aspire init --language csharp --agents none --use-config-source false --non-interactive -
Initialize Aspire support and enable skill sources for GitHub Copilot without prompts:
Aspire CLI aspire init --non-interactive --language csharp --agents copilot --skills aspire --scope project