Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News .NET Aspire Preview 6: Enhanced Security and Testing, New Features, and More

.NET Aspire Preview 6: Enhanced Security and Testing, New Features, and More

This week Microsoft released Preview 6 of the .NET Aspire project. Significant changes have been implemented to enhance the security and reliability of the platform. This release, version 8.0.0-preview.6.24214.1, introduces several noteworthy additions, like changes related to templates, components, dashboard, testing and more.

The breaking changes notable among these are related to the Service Discovery API and the removal of all obsolete APIs. Also, the team announces more breaking changes before the API is in the stable release.

Several adjustments have been made to improve the security of .NET Aspire. These enhancements include securing communication between various components such as the orchestrator, IDE, and dashboard, by utilizing TLS and API keys for authentication. As stated:

This prevents unauthorized users from accessing potentially sensitive information exposed by the app host project and the dashboard when running locally on your machine.

A significant change in this release is the addition of authentication requirements for accessing the dashboard. Given the sensitive nature of the data displayed on the dashboard, such as configuration details and telemetry data, authentication is now mandatory even in local development environments.

For users accessing .NET Aspire apps through Visual Studio or C# Dev Kit for Visual Studio Code, authentication occurs seamlessly without encountering a login page, thanks to updated Aspire tooling. However, users deploying .NET Aspire apps via the command line will need to perform an initial login to the dashboard. The required token is provided in the console output for users to copy and paste onto the login page, establishing a persistent authentication cookie.

(A persistent auth cookie, Source: Microsoft Documentation)

The Preview 6 release introduces the following additions: Aspire.Hosting.Qdrant which provides resource definition for configuring a Qdrant vector database resource within a .NET Aspire AppHost. Meanwhile, another one is the client called Aspire.Qdrant.Client, offering a library for interacting with a Qdrant vector database.

Regarding the AppHost updates, preview 6 brings various new APIs and features to it, including the capability for users to specify custom container runtime arguments, pass project resources' arguments programmatically, customize environment variable names for connection strings, and ensure compatibility with other container runtimes through fully qualified container images.

In an official announcement, the team stated the importance of testing in the development process; new testing APIs have been introduced to assist in testing Aspire applications, following a pattern similar to the WebApplicationFactory in ASP.NET Core.

using System.Net;

namespace AspireApp.Tests;

public class WebTests
    public async Task GetWebResourceRootReturnsOkStatusCode()
        // Arrange
        var appHost = await DistributedApplicationTestingBuilder.CreateAsync<Projects.AspireApp_AppHost>();
        await using var app = await appHost.BuildAsync();
        await app.StartAsync();

        // Act
        var httpClient = app.CreateHttpClient("webfrontend");
        var response = await httpClient.GetAsync("/");

        // Assert
        Assert.Equal(HttpStatusCode.OK, response.StatusCode);

(Source: Microsoft Documentation)

Furthermore, updates have been made to the latest stable versions of the OpenTelemetry SDK and Instrumentation packages to simplify the OTLP exporter configuration using newer APIs. As reported, this feature automates the configuration of the OTLP exporter, directing metrics, traces, and logs to the designated OTLP endpoint specified within the OTEL_EXPORTER_OTLP_ENDPOINT environment variable.

Also, regarding OpenTelemetry the dependencies on pre-release versions have been removed, and replaced with the latest stable versions wherever possible. Additionally, the dependency on OpenTelemetry.Instrumentation.EventCounters has been removed.

Azure provisioning packages have been restructured into individual packages per service, allowing for selective installation based on user requirements. Users utilizing Azure provisioning packages directly, as stated are advised to update their project files to reference the new packages.

The Azure Developer CLI  now supports deploying projects, containers, or docker files with multiple endpoints, which will be mapped to the Azure Container App's ingress.

Finally, it has been reported that the .NET Aspire team is dedicated to issuing a new preview edition each month, to achieve a stable 8.0 release by the second quarter of 2024. This month developers could explore both Preview 5 and Preview 6.

Microsoft has stated that these scheduled releases are intended to offer developers consistent updates, incorporating new features and enhancements during the ongoing development phase.

About the Author

Rate this Article