Q&A

Introduction to .NET Aspire

.NET Aspire is a cloud-native application stack designed to simplify the development of distributed systems in .NET. Introduced at Microsoft's 2024 Build developer conference, it provides a set of tools, templates, and libraries to help developers build and manage interconnected services efficiently.

It streamlines cloud-native development by automating service discovery, managing configurations, and handling dependencies between services. It provides NuGet packages for seamless integration with services like Redis and PostgreSQL, complete with built-in telemetry and health checks. Developers benefit from tailored project templates and CLI tools for Visual Studio, along with a web-based dashboard that offers real-time observability through logs, metrics, and distributed tracing, simplifying monitoring and debugging.

.NET Aspire
[Click on image for larger view.] .NET Aspire (source: Microsoft).

That involves a lot of moving parts, with new features and functionality being added all the time. So, to help developers get up to speed on .NET Aspire, we reached out to two Microsoft experts who will present a session on the topic at the March 10-14 Visual Studio Live! developer conference in Las Vegas. Jon Galloway, principal program manager, Developer Division Community Team, and James Montemagno, principal lead program manager, Developer Community, will present an Introduction to .NET Aspire where attendees are promised to learn:

  • What problems .NET Aspire solves
  • How to use .NET Aspire in existing applications
  • How to be more productive building distributed .NET applications with .NET Aspire

We caught up with the duo to learn more about the tech, their session and how attendees can prepare for it.

VisualStudioMagazine: What inspired you to present a session on this topic?
Galloway/Montemagno: A lot of developers have heard about .NET Aspire, some have tried it out. We've heard that some are wondering if it is right for their .NET projects, and our answer to this is YES! .NET Aspire can add a lot of value to a wide variety of .NET applications.

"We wanted to create a session so anyone can learn exactly what .NET Aspire is, what it isn't, and how to add .NET Aspire to an existing real-world application to see how each of the different features help developers be more productive and get more insight."

Jon Galloway, James Montemagno

We wanted to create a session so anyone can learn exactly what .NET Aspire is, what it isn't, and how to add .NET Aspire to an existing real-world application to see how each of the different features help developers be more productive and get more insight.

Inside the Session

What: Introduction to .NET Aspire

When: March 12, 9:30 a.m. - 10:45 a.m.

Who: Jon Galloway, Principal Program Manager, Developer Division Community Team, Microsoft; James Montemagno, Principal Lead Program Manager, Developer Community, Microsoft

Why: Learn valuable insights into the latest trends and best practices in cloud-native development with .NET.

Find out more about VS Live! taking place March 10-14 at Paris Las Vegas Hotel & Casino

We've noticed Microsoft has been heavily pushing .NET Aspire in its dev tooling guidance lately, all over the place, so what specific challenges in .NET application development does .NET Aspire address?
We believe that .NET Aspire truly enables developers to easily build more observable, scalable, manageable, and resilient applications. These are things that pretty much any application needs, and .NET Aspire makes it really easy to get them set up.

There are two parts to this. The first is building your app and integrating in popular services. .NET Aspire adds a set of extendable defaults for all projects enabling service discovery, resiliency, telemetry, and health checks. It also provides an extensive list of integrations that opt into these defaults.

The second part is what we call the developer "inner-loop." This just means things that we do every day on our development machine when building apps such as adding projects or services to projects, downloading and starting containers, starting up multiple projects, and giving developers an amazing experience to get insight into their application with a dashboard showing logs, traces, metrics, and overall application health. There is something for every single developer and every app with .NET Aspire.

How do features like service discovery, telemetry, resilience, and health checks integrate within .NET Aspire?
These features are all available in .NET and we have had some really useful features added with each release, but developers need to go turn them on. In some cases, this meant you had to go read a bunch of complicated docs to figure out exactly how to set up those features, including figuring out which settings to use. So when we talked to developers, we heard them asking for features we'd already shipped a few versions back, they were just hard to use.

.NET Aspire gives a set of best practices from the team as a set of defaults that get added to your projects. What's neat is that it lights up all of these features automatically for you, using recommended settings that you can tweak if you want, using a project reference and a single line of code. It works the same way for both new and existing apps.

These defaults also work for integrations that you may add such as a Redis Cache, SQL database, or AI service. OpenTelemetry empowers deep insights into the entire application and its dependencies so you can see an entire trace of an operation to diagnose what is going right and wrong. Standard resiliency is enabled so your application will automatically retry if a service goes down or connection is spotty. Health checks help you understand not only the health of a single project, but all of its dependencies as well. All of them are customizable and extendable to your exact needs for your application. There's also a lightweight service discovery part that you can take advantage of -- this means you no longer need to hard code IP addresses and ports for services because .NET Aspire will automatically create environment variables and opt apps into service discovery.

How does the Starter template improve the local development experience for .NET developers?
.NET Aspire can easily be added to existing .NET projects with Visual Studio or Visual Studio Code with just a few clicks in the IDE. They will automatically create the App Host that is used for orchestration of all of the app's projects and integrations. It will also create the service defaults and configure all of the projects automatically, which is great. If you want to simply explore .NET Aspire,the starter project is a great place as it will show you how to properly configure .NET Aspire across multiple .NET projects that include a .NET Web API project and a Blazor frontend project. It also has the option to integrate a Redis cache with the .NET Aspire integration and configure it. This is great because you can see exactly how things work out of the box with service discovery, resiliency, health checks, and telemetry. Start exploring and take what you like and bring it into your apps.

What considerations should developers keep in mind when incorporating .NET Aspire into existing .NET applications?
.NET Aspire is great for just about every application no matter what the scale is of it. You can use some of .NET Aspire or all of .NET Aspire. You decide what is best for your application. Some developers use just the .NET Aspire AppHost for orchestration of their projects, while others deeply integrate telemetry and leverage the dashboard locally and even in production, and some use every single part of .NET Aspire, including the streamlined deployment to Azure Container Apps. The great part is that you don't need to change your deployment or CI/CD setup at all, everything is optional. You decide if you want to use new connection strings or leverage ones created by .NET Aspire. It is all about developer choice.

Are there specific migration strategies or tools provided by .NET Aspire to facilitate this integration?
Both Visual Studio and Visual Studio Code (with the C# Dev Kit) make it extremely simple to easily add orchestration and service defaults with just a few clicks. .NET Aspire also ships with several templates if you would rather manually configure the integration as well.

What you'll find, though, is that it's really well structured so that adding .NET Aspire to existing apps is a pretty light touch. You don't have to worry about a lot of code getting added to your projects; a single line in your existing project's Program.cs turns on the service defaults.

The best migration strategy is to just get started -- adding .NET Aspire into your apps isn't complicated. Once you've got it in place, you can start taking more advantage of the features it offers with things like integrations, service discovery, better telemetry. And you might find that it gives you some new options on containerized deployment if you want to explore that. But none of those are necessary, you can just add .NET Aspire to your app and you'll find that you're saving dev time right away, and if that's as far as you take it that's just great.

What resources would you recommend for developers to get up to speed with for .NET Aspire and prepare for your session?
Lots of great things including documentation, free training, credentials, and getting started videos! Here are some links:

Note that this session is just one of several that will address .NET Aspire at the VSLive! event, where Galloway and Montemagno will also dive deeper into the tech in a full-day hands-on workshop titled Hands-On Lab: Get Started with .NET Aspire & ASP.NET Core for Distributed Application Building. Also, Montemagno will go solo to present Fast Focus: .NET Aspireify Your Apps in Minutes to Boost Productivity & Insights. What's more, Microsoft's Davide Mauri will helm Get Started Using .NET Aspire with SQL Server & Azure SQL Database. Another session presented by yet another Microsoft expert, Justine Cocchi, is titled Building AI Copilots: Integrate Semantic Kernel, Azure OpenAI, and Azure Cosmos DB with .NET Aspire.

Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Save $300 when you register by the Extended Early Bird savings deadline of Feb. 21," said the organizer of the event, which is presented by the parent company of Visual Studio Magazine.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events