Jeffrey Fritz presents an in-depth walkthrough of the Aspire CLI, illustrating its use for .NET application development—from installation to running, integrating Azure services, and publishing distributed systems.

Getting Started with the Aspire CLI

The Aspire CLI is a powerful, cross-platform tool designed to streamline the development, management, and deployment of .NET application systems. It’s suitable for building anything from simple websites to enterprise-scale distributed applications leveraging microservices, queues, and databases.

1. Installing the Aspire CLI

Before you start, ensure you have the .NET 9.0 SDK installed.

a. Installation as a Native Executable

  • Windows: Run in PowerShell

    Invoke-Expression "& { $(Invoke-RestMethod https://aspire.dev/install.ps1) }"
    

    Installs Aspire CLI to %USERPROFILE%\.aspire\bin (custom paths and versions are optional).

  • Unix (Linux/macOS): Run in terminal

    curl -sSL https://aspire.dev/install.sh | bash
    

    Installs to $HOME/.aspire/bin by default.

For custom options and troubleshooting, consult the official documentation.

b. Installation as a .NET Global Tool

This works cross-platform. Run:

dotnet tool install -g Aspire.Cli --prerelease

Verify installation:

aspire --version

If you see a version number, installation succeeded.

2. Creating a New Project with Templates

To create a new project, run:

aspire new

This launches an interactive setup to select templates, name your project, and specify an output folder.

Available Templates:

  • Starter – Multi-project system demonstrating basics
  • AppHost & service defaults – Orchestrated solution with defaults for distributed apps
  • AppHost – Entry-point orchestrator only
  • Service defaults – Projects with recommended .NET practices for microservices/websites
  • Integration tests – Foundation for distributed application integration testing

The CLI fetches the latest templates and generates the solution structure.

Demo Video

3. Adding Integrations and Packages

To add official integration packages (e.g., databases, messaging), use:

aspire add

You can provide a package/NuGet ID directly or browse the interactive list. Example integrations:

  • Azure CosmosDB
  • Azure Event Hubs
  • Azure Functions
  • Azure Key Vault
  • Azure PostgreSQL
  • Azure Redis
  • Azure Service Bus
  • Azure SignalR

This workflow simplifies dependency management directly from your terminal.

Integration Demo

4. Running and Debugging Your Application

To launch in development mode, use:

aspire run

This command:

  • Sets up Aspire environment
  • Builds/starts all AppHost resources
  • Launches the Aspire dashboard (view logs, metrics, diagrams)
  • Displays endpoint info

Example output:

Dashboard: https://localhost:17178/login?t=...
Logs: .../.aspire/cli/logs/apphost-...log

Logs persist to disk for review.

Run Demo

5. Publishing Your Application

The publishing feature is in preview. Use:

aspire publish

This serializes resources for deployment—generating assets for Azure, Docker Compose, or Kubernetes depending on integrations.

A deploy command exists but is not yet functional.

Conclusion

The Aspire CLI is designed as a one-stop workflow tool for .NET application professionals, providing streamlined processes from project creation to deployment. Source code is available on GitHub.

Install Aspire CLI today to facilitate your next .NET distributed application project.

This post appeared first on “Microsoft .NET Blog”. Read the entire article here