News
Cloud-Native .NET Aspire 8.1 Targets Building Containers, Orchestrating Python
Microsoft's first significant update to .NET Aspire addresses the building of container images and the orchestration of Python code among a bevy of new features and enhancements.
.NET Aspire is for cloud-native app development, providing a framework for building, testing and deploying distributed apps that typically leverage cloud constructs like microservices, containers, serverless architecture and so on. The new 8.1 release, announced on Tuesday, is the first significant update to the platform since it became generally available in May, though preview bits were already baked into .NET 8.
Since then, Microsoft has been making a big push to publicize the new offering, indicating its importance to the company.
The framework itself could be called distributed, as it comes in a collection of NuGet packages that can be used to build apps in Visual Studio, Visual Studio Code or the command line.
"This release includes several new features and quality of life improvements based on feedback from developers using .NET Aspire in production applications," said Microsoft's Mitch Denny in a July 23 announcement of .NET Aspire 8.1.
He highlighted two specific features of the update: support for building container images with the AddDockerfile(...)
method and orchestrating Python code with AddPythonProject(...)
method.
Container Images
Working with the AddDockerfile(...)
method that automatically builds a Docker file when the App Host runs, the WithDockerfile(...)
method also helps developers automate Dockerfile building and customization by allowing for easy editing and integration with existing resources. So the former is ideal for creating new container resources, while the latter is used for modifying existing container images.
Both methods support build arguments and secrets, enabling developers to pass parameters and sensitive information securely to the Docker build process while avoiding accidental disclosure in the application manifest.
"This means that you can quickly edit your Dockerfiles and rely on .NET Aspire to build them without having to manually build them yourself," Denny said.
Orchestrating Python Code
This second major feature highlighted by Denny enhances support for polyglot microservice architectures via the code orchestration AddPythonProject(...)
method. In .NET Aspire, orchestration primarily focuses on enhancing the local development experience by simplifying the management of a cloud-native app's configuration and interconnections.
The method, contributed by Willem Meints, allows developers to launch Python-based services. To use it, devs need to install the Python hosting package and add a Python resource to their application model. The method leverages Python's virtual environment (venv) tool and requires manual installation of dependencies specified in the requirements.txt
file. Additionally, if the opentelemetry-distro[otlp]
dependency is included, it enables telemetry in the .NET Aspire dashboard. However, due to a limitation with OpenTelemetry libraries, the application must be run with the ASPIRE_ALLOW_UNSECURED_TRANSPORT
environment variable set to true
.
The Python support joins existing support for Node.js apps.
More Updates
Denny's post also provides details about:
- New resource types and components coming in containerized extensions ranging from Kafka UI to Azure Web PubSub
- Testing improvements (easier to write test cases that need to wait for resources to initialize)
- Metrics exemplars (example data points for aggregated data)
- Span links (create relationships between spans)
- Improved instance ID names (friendly instance IDs instead of hard-to-read GUIDs)
More information can be found in Microsoft's What's new in .NET Aspire documentation.
About the Author
David Ramel is an editor and writer at Converge 360.