aspire add
Add a hosting integration to the AppHost.Usage
Description
Theaspire add command adds NuGet packages for Aspire hosting integrations to your AppHost project. Integrations provide pre-configured resources like databases, message queues, caching, and cloud services.
What it Does
- Searches for integrations - Queries NuGet feeds for available Aspire hosting packages
- Prompts for selection - Shows available integrations and versions
- Stops running instances - Automatically stops any running AppHost to avoid file locks
- Adds the package - Runs
dotnet add packageto install the integration - Confirms success - Displays the installed package and version
Program.cs to use it.
Arguments
The name of the integration to add (e.g.,
redis, postgres, rabbitmq)Example: aspire add redisIf not specified, you’ll be prompted to select from available integrations.Supports fuzzy matching: aspire add pg will find PostgreSQL integrations.Options
The path to the Aspire AppHost project fileExample:
--apphost ./src/MyApp.AppHost/MyApp.AppHost.csprojIf not specified, the CLI searches for an AppHost project in the current directory and parent directories.The version of the integration to addExample:
--version 10.0.0If not specified, you’ll be prompted to select from available versions.The NuGet source to use for the integrationExample:
--source https://api.nuget.org/v3/index.jsonExamples
Add Redis
Program.cs:
Add with interactive selection
Add PostgreSQL
Add with fuzzy search
Aspire.Hosting.RabbitMQ.
Add a specific version
Add from a custom source
Available Integrations
Databases
- postgres - PostgreSQL database (
Aspire.Hosting.PostgreSQL) - sql-server - SQL Server database (
Aspire.Hosting.SqlServer) - mysql - MySQL database (
Aspire.Hosting.MySql) - mongodb - MongoDB database (
Aspire.Hosting.MongoDB) - oracle - Oracle database (
Aspire.Hosting.Oracle)
Caching & State
- redis - Redis cache and pub/sub (
Aspire.Hosting.Redis) - garnet - Garnet cache (
Aspire.Hosting.Garnet) - valkey - Valkey cache (
Aspire.Hosting.Valkey)
Messaging
- rabbitmq - RabbitMQ message broker (
Aspire.Hosting.RabbitMQ) - kafka - Apache Kafka (
Aspire.Hosting.Kafka) - nats - NATS messaging (
Aspire.Hosting.Nats)
Azure Services
- azure-storage - Azure Storage (Blobs, Queues, Tables) (
Aspire.Hosting.Azure.Storage) - azure-cosmos-db - Azure Cosmos DB (
Aspire.Hosting.Azure.CosmosDB) - azure-service-bus - Azure Service Bus (
Aspire.Hosting.Azure.ServiceBus) - azure-key-vault - Azure Key Vault (
Aspire.Hosting.Azure.KeyVault) - azure-event-hubs - Azure Event Hubs (
Aspire.Hosting.Azure.EventHubs)
Observability
- seq - Seq structured logging (
Aspire.Hosting.Seq) - elastic - Elasticsearch (
Aspire.Hosting.Elasticsearch)
Other Services
- milvus - Milvus vector database (
Aspire.Hosting.Milvus) - qdrant - Qdrant vector database (
Aspire.Hosting.Qdrant)
aspire add and browse the interactive list.
Integration Naming
Package names are converted to friendly short names:Aspire.Hosting.Redis→redisAspire.Hosting.PostgreSQL→postgresqlAspire.Hosting.Azure.Storage→azure-storage
Version Selection
When multiple versions are available, you’ll be prompted:- Stable versions are listed first
- Preview versions are shown with their full version numbers
- Daily channel provides the latest daily builds
Channels
Integrations can come from different channels:- stable - Released versions from nuget.org
- daily - Daily builds from dotnet-public feed
- staging - Staging builds (when enabled)
Community Integrations
Community-contributed integrations are prioritized in the list for discoverability. These packages start withCommunityToolkit.Aspire.Hosting.*.
Running Instance Detection
Before adding a package, the CLI:- Detects any running instances of your AppHost
- Stops them automatically to avoid file locks
- Displays a message confirming the stop
dotnet add package from failing due to locked project files.
After Adding an Integration
After runningaspire add, you need to:
- Update Program.cs - Add the resource to your AppHost
- Add references - Wire up the integration to your services
- Run the AppHost - Test the integration
Program.cs:
Removing Integrations
To remove an integration:Program.cs.
See Also
- aspire run - Run your AppHost with integrations
- Hosting Integrations - Learn about all available integrations