What does the Aspire 13 CLI command aspire add install, and where do the Aspire Community Toolkit's integrations fit?
answer
- hosting packages only
- AppHost project, not the service
- friendly names like redis or postgresql
- CommunityToolkit.Aspire.Hosting.* ids
- community-maintained, versioned with Aspire
basics
~20 saspire add searches NuGet for hosting integrations — Aspire.Hosting.* and CommunityToolkit.Aspire.Hosting.* packages — and adds the chosen one to the AppHost. The matching client package goes into the service separately, for example with dotnet package add.
solid answer
~40 s`aspire add redis` finds an AppHost, searches NuGet and adds `Aspire.Hosting.Redis` to it: a `PackageReference` for a project AppHost, a `#:package` directive for a file-based one. Its search is limited to `Aspire.Hosting.*` and `CommunityToolkit.Aspire.Hosting.*` ids, so it never installs a client package — `Aspire.StackExchange.Redis` goes into the recipe API with `dotnet package add` or `dotnet add package`. Options include `--version`, `--source` and `--apphost`. The Aspire Community Toolkit is a separate, community-maintained repository of integrations that the Aspire team does not officially support. Its packages are named `CommunityToolkit.Aspire.Hosting.*` and `CommunityToolkit.Aspire.*` — for example `CommunityToolkit.Aspire.Hosting.Sqlite` with the `AddSqliteDbContext` client — and they keep Aspire's major and minor version, so 13.6 toolkit packages go with Aspire 13.6.
code
bash · 8 lines# AppHost side: hosting integrations (official and community)
aspire add redis
aspire add postgresql
aspire add communitytoolkit-postgresql-extensions
# Service side: client integrations, added with the .NET SDK
dotnet package add Aspire.StackExchange.Redis --project src/Recipes.Api
dotnet package add Aspire.Npgsql.EntityFrameworkCore.PostgreSQL --project src/Recipes.Apigo deeper
Recall that aspire add puts a hosting integration into the AppHost and that the client package for a service is added separately with the .NET CLI.
Explain the package filter (Aspire.Hosting.* and CommunityToolkit.Aspire.Hosting.*), friendly names, and the options --version, --source and --apphost.
Assess toolkit packages before adopting them: version alignment with the AppHost, community support only, and preferring official resources with toolkit extensions layered on top.
Set a policy for third-party integrations in the solution: which toolkit packages are allowed, who owns their upgrades, and when to write an in-house integration instead.
## What aspire add is for The **Aspire CLI** (`aspire`) is the command-line tool for Aspire solutions: `aspire new`, `aspire run`, `aspire add`, `aspire publish` and others. `aspire add` installs an **integration package into the AppHost** — the project that describes resources such as databases and caches. ```bash aspire add redis aspire add postgresql --version 13.6.0 aspire add --apphost ./Recipes.AppHost/Recipes.AppHost.csproj ``` What it does, step by step: 1. It locates the AppHost (or uses `--apphost`). 2. It searches the configured NuGet feeds (or `--source`) for integration packages. 3. It matches the argument against a **friendly name** — the package id with `Aspire.Hosting.` removed, dots turned into dashes and lower-cased, so `Aspire.Hosting.PostgreSQL` is `postgresql` — or the full id. A partial or misspelled name produces a list of close matches to pick from; no argument lists everything. 4. It writes the reference in the form the AppHost uses: a `PackageReference` in a project AppHost, a `#:package` directive in a file-based `apphost.cs`, or an entry in `aspire.config.json` for a TypeScript AppHost. ## What it does not install The CLI filters packages to ids starting with `Aspire.Hosting.` or `CommunityToolkit.Aspire.Hosting.`, and excludes infrastructure ids such as `Aspire.Hosting.AppHost` and `Aspire.Hosting.Testing`. **Client integrations are outside that filter.** After `aspire add redis`, the recipe API still needs the client package: ```bash dotnet package add Aspire.StackExchange.Redis --project src/Recipes.Api ``` `dotnet add package` is the older spelling of the same SDK command and still works. Forgetting this step is a common reason `builder.AddRedisClient` does not compile. ## In scripts and CI `aspire add` is interactive by default — it prompts for a package or a version when the argument is ambiguous. In a script, pass `--non-interactive` with an exact friendly name or package id and `--version`: in that mode the CLI never falls back to fuzzy search, so an inexact name is an error instead of a guessed package. The resulting `.csproj` change is an ordinary `PackageReference`, so Central Package Management, lock files and restore treat it like any other package. ## The Aspire Community Toolkit The **Aspire Community Toolkit** (`CommunityToolkit/Aspire`) is a community-driven collection of integrations and extensions built on Aspire. Its own FAQ is explicit that it is maintained by the community and **not officially supported by the Aspire team**. The aspire.dev integration pages mark its entries with a Community Toolkit badge and say such integrations are not part of the core Aspire SDK. | | Official integrations | Community Toolkit | |---|---|---| | Hosting package ids | `Aspire.Hosting.*` | `CommunityToolkit.Aspire.Hosting.*` | | Client package ids | `Aspire.*` (e.g. `Aspire.StackExchange.Redis`) | `CommunityToolkit.Aspire.*` (e.g. `CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite`) | | Maintained by | the Aspire team | community contributors | | Versioning | the Aspire release (13.6.0) | same major and minor as Aspire; patch may differ | | Found by `aspire add` | yes | yes, with names starting `communitytoolkit-` | Two kinds of toolkit package are common: - **New resources** the official set lacks, such as `CommunityToolkit.Aspire.Hosting.Sqlite` (`AddSqlite`) with its client `AddSqliteDbContext`, or hosting for Ollama, MailPit and Golang apps. - **Extensions** that decorate official resources, such as `CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions`, which adds `WithDbGate()` and `WithAdminer()` admin UIs to an `AddPostgres` resource. ## Judging a toolkit package - Check that its major and minor version match the AppHost's Aspire version; the toolkit's versioning guide promises that alignment, with a possible lag after an Aspire release. - Treat support as community support: issues go to the toolkit repository, not the Aspire repository. - Prefer an official integration when one exists for the same resource, and use toolkit extensions to add to it rather than replace it.
- How does aspire add treat a name it cannot match exactly?It scores the argument against each integration's friendly name and package id, and if nothing matches exactly it shows the close matches for you to pick from; when nothing scores high enough it lists all integration packages. `--version` pins a version and `--source` points it at a specific NuGet feed.
- Why should toolkit package versions track the AppHost's Aspire version?The toolkit's versioning guide keeps the major and minor version equal to Aspire's — a 13.6.x toolkit package targets Aspire 13.6 — while patch numbers may differ. Mixing a toolkit package built for an older Aspire minor with a newer AppHost risks API mismatches the toolkit has not been tested against.
- aspire add redis also installs Aspire.StackExchange.Redis into every service project.
- aspire add writes the package into whichever project is in the current directory.
- Community Toolkit integrations carry the same official support as Aspire.Hosting.* packages.
- Toolkit packages version independently of Aspire, so any 9.x toolkit release fits an Aspire 13 AppHost.
- aspire add can only install packages published by the Aspire team.
Assumes the Aspire 13.6 CLI: file-based (#:package) and TypeScript (aspire.config.json) AppHosts are 13.x shapes, and the toolkit 13.6 packages track Aspire 13.6.