Select Page

.NET Aspire is a .NET-based stack for cloud-native application development that can be deployed to Microsoft Azure. Streamlining cloud-native development with .NET Aspire helps developers achieve efficiency and scalability.

Estimated reading time: 3 minutes

The stacks come with an orchestration role that shows all the application’s resources, discovers endpoints, and performs service discovery.

Each .NET Aspire solution is named using the following naming standards:

components

Each .NET Aspire comprises a Nuget package you add to the solution as a service. By default, Aspire comes with the following.

Database components – Aspire supports and includes out-of-the-box components for MySQL, Cosmos DB, MongoDB, Azure Cosmos DB and SQL Database

Storage components – When it comes to storing data, Aspire has built-in components for all the core Azure storage services, including Azure Blob, Table, and Queue storage.

Caching components – For speedy application performance, Aspire uses all the major Redis components (Output and distributed)

Messaging components – For microservices communication, Aspire has components for RabbitMQ, Apache Kafka and Azure Service Bus.

Azure-based components – Besides the above, Aspire has components for all Azure services, including the Azure Key Vault for storing secrets and certificates.

Adding Components

We can add components using the Nuget package manager (VS), C# Dev Kit or .NET CLI using a command like this:

Components are registered and added as a dependency injection in a project using the following code blocks.

Developing Aspire-based solutions can be done using Visual Studio or Visual Studio Code. Aspire also comes with a web interface (Dashboard) that displays all the services for the solution and their status.

Install .NET Aspire (Visual Studio 2022)

To install .NET Aspire on a Windows machine running Visual Studio 2022, open a PowerShell terminal and run the following command.

Project Templates

Like any .NET template, Aspire comes with five templates from which we can create a new application.

  • .NET Aspire Application – Minimal solution with two .NET projects (App Host for project orchestration and Service Defaults for managing configuration details)
  • .NET Aspire Starter Application – Complete solution that includes App Host, Service Defaults, Back-End API and front-end web interface.
  • .NET Aspire App Host – Creates an App Host project only.
  • .NET Aspire Service Default – Creates a Service Defaults project only.
  • .NET Aspire Test Project – Creates xUnit tests for an App Host.

In addition, you can add .NET Aspire to an existing .NET Web application by right-clicking on a project, clicking on Add, and selecting .NET Aspire Orchestrator support.