Watch Aspire live streamsDocsTry Aspire

aspire init command

aspire init - Initialize Aspire support in an existing codebase with a C#, TypeScript, or Go AppHost.

Aspire CLI
aspire init [options]

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.

The command adapts to the repo it finds:

  • C# file-based AppHost (when selected interactively) — creates apphost.cs with #:package directives for a lightweight single-file orchestrator.
  • TypeScript AppHost (when selected interactively) — creates apphost.mts with the generated .aspire/modules/ folder. If the repo already has a root package.json, the AppHost is created as a nested aspire-apphost/ package and the root aspire.config.json points to aspire-apphost/apphost.mts.
  • Go AppHost (when selected interactively): creates apphost.go, a go.mod that points at the generated SDK, and the generated .aspire/modules/ folder. If the repo already has a root go.mod, the AppHost is created as a separate aspire-apphost/ module with its own go.work file, and the root aspire.config.json points to aspire-apphost/apphost.go. Your existing go.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.

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.

LanguageDefault hosting packages
TypeScriptAspire.Hosting.JavaScript
PythonAspire.Hosting.Python
GoAspire.Hosting.Go
Java, RustNone 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 CLI
aspire init --file-based --language csharp

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:

aspire.config.json
{
"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.

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

The following options are available:

  • --language

    The AppHost language to scaffold (csharp, typescript, go).

  • --file-based

    Create apphost.cs in 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-source or --use-config-source true to accept, or --use-config-source false to 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, or opencode. Use all to configure all supported agents or none to skip agent configuration. For selection defaults, see the aspire agent init command 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, or dotnet-inspect. Use all for every applicable choice or none to skip them. Defaults to aspire, which applies all enabled skill sources. For details, see the aspire agent init command reference.

  • -?, -h, --help

    Prints 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-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • 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 .sln or .slnx files:

    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