Microsoft has released .NET 8 to general availability – a long-term support version – together with a preview of Aspire, a new “cloud ready stack” for building applications that are observable, distributed, and resilient.
There is plenty new in .NET 8 which is already known via its many previews, but the Aspire framework is new to most developers.
According to Glenn Condron, principal program manager on the .NET team: “what we heard from developers is that … building apps for the cloud was still too hard.” Aspire includes elements first used in an earlier experiment called Project Tye, first released in 2020, though Project Tye was designed for Kubernetes whereas Aspire does not make that assumption.
Aspire, which is open source on GitHub, is to be part of .NET 8 and will be versioned with .NET in future. Full tooling is in the latest Visual Studio preview, 17.9 preview 1, which means Windows only for development, though Linux and Mac users can use it without some of the developer tools.
A starter Aspire application example includes a Blazor web application, a back-end API, and a Redis cache. Two Aspire projects are added to the solution, one called AppHost which runs any .NET projects as part of a distributed application, and one called ServiceDefaults which provides features including service discovery, telemetry and health check endpoints. A developer dashboard is included, which lists services, collects and displays logs, and shows metrics and traces for the parts of the application.
Aspire supports components, where each component has to provide by default resiliency, health checks and telemetry and to integrate with dependency injection, a technique for adding services to an application which is commonly used in .NET applications. Condron gives as an example the Redis component which adds a Redis cache with one call to AddRedis, creating a default configuration that can be overridden as needed.
The initial set of components includes PostgreSQL, RabbitMQ, Redis, SQL Server, Azure Blob Storage, Azure Cosmos DB, Azure Key Vault, Azure Service Bus and Azure Storage Queues. The database components come with both Entity Framework and plain client versions, where Entity Framework is the standard .NET ORM (Object-Relational Mapping) library.
Telemetry is based on the Open Telemetry project for creating and managing telemetry data, which can then be passed to a variety of tools. Open Telemetry is supported by around 40 vendors, including familiar names like Grafana, Splunk, New Relic, Datadog and Dynatrace, as well as open source projects such as Jaeger and Prometheus.
Deployment of an Aspire app is intended to be container-based. Aspire can produce a manifest defining the relationship between different services in an application, and tools can then consume the manifest for deployment. Microsoft provides integration with Azure Container Apps to “immediately provision and deploy the Azure resource in one step,” Condron writes.
Existing applications can have Aspire support added, provided they are upgraded to .NET 8. In Visual Studio, developers can then add Aspire Orchestration Support, which will add the AppHost and ServiceDefaults projects to a solution.
Project Tye was welcomed on first release but saw little activity after its first few months. Developers will no doubt wonder whether Microsoft will follow through on the promise to keep Aspire up to date as .NET progresses. Condron states that it will reach general availability in Spring 2024, just six months away, so the intention is there for now.
Another key question is what level of third-party support the project will attract. It is understandable that the current Aspire preview is geared towards Visual Studio and Azure, but that is also a limitation, if Aspire is intended to support more than just Microsoft’s platform.