
The demand for cloud-native applications has soared due to the impressive features offered by cloud services, such as high availability, scalability, durability, low maintenance, easy configurability, robust security, and efficient monitoring tools. Despite these advantages, designing a cloud-native application can be a complex and time-consuming task, requiring careful consideration of various factors. Developers often find themselves grappling with decisions about technologies, tools, stacks, and cloud services, leading to confusion and challenges in building future-proof cloud solutions.
Recognizing these struggles, developers have expressed the need for a more accessible solution. Building applications for the cloud has been perceived as too challenging, diverting developers from their primary focus on business logic. The good news is that there’s an incredible solution to simplify cloud-ready application development and solution design – introducing .NET Aspire.
.NET Aspire is a user-friendly solution designed for crafting applications ready for the cloud. It simplifies the development process, allowing developers to focus on their core business logic. Packaged as a set of NuGet packages, .NET Aspire handles specific cloud-related concerns. Whether you’re dealing with databases, messaging, or caching, .NET Aspire has you covered. It’s your go-to stack for creating cloud-ready, observable, and production-ready applications.
Cloud-native applications often need to connect to diverse services, including databases, storage and caching solutions, messaging providers, and other web services. .NET Aspire is crafted to simplify the process of establishing connections and configurations across these services.
In this article, we will learn about .NET Aspire, getting started, and developing a .NET Aspire app, a cloud-ready application using Visual Studio.
.NET Aspire is available in preview with .NET and will be released generally as part of .NET 8 next year.
Getting Started with .NET Aspire
In this section, we create a project with .NET Aspire. Let’s commence.
Prerequisites
- Visual Studio 2022 Preview
- Download Visual Studio 2022 Preview from here.
- https://visualstudio.microsoft.com/vs/preview/
- .NET 8 (Click Here)
- Docker Container
- .NET Aspire Workload
Alternatively, we can use Visual Studio Code as IDE.
We will Install the Preview Version of Visual Studio 2022.

Then, we will install the .NET Aspire workload from the command as shown below.
dotnet workload install aspire

We need to restart the machine to get the .NET Aspire project templates. Let’s open the Visual Studio Preview after restart.

We will select the .NET Aspire Starter Application from the project template.

We will input a solution name as MyFirstAspireApp.

Select .NET 8.0 LTS, and also check the use of Redis for caching (requires Docker) option.
Our .NET Aspire project was created successfully. Let’s explore the projects and structure of the solution.

Solution Folder Structure
└───📂 MyFirstAspireApp
├───📂 MyFirstAspireApp.ApiService
│ ├───📂 Properties
│ │ └─── launchSettings.json
│ ├─── appsettings.Development.json
│ ├─── appsettings.json
│ ├─── MyFirstAspireApp.ApiService.csproj
│ └─── Program.cs
├───📂 MyFirstAspireApp.AppHost
│ ├───📂 Properties
│ │ └─── launchSettings.json
│ ├─── appsettings.Development.json
│ ├─── appsettings.json
│ ├─── MyFirstAspireApp.AppHost.csproj
│ └─── Program.cs
├───📂 MyFirstAspireApp.ServiceDefaults
│ ├─── MyFirstAspireApp.ServiceDefaults.csproj
│ └─── Extensions.cs
├───📂 MyFirstAspireApp.Web
│ ├───📂 Components
│ │ ├───📂 Layout
│ │ │ ├─── MainLayout.razor
│ │ │ ├─── MainLayout.razor.css
│ │ │ ├─── NavMenu.razor
│ │ │ └─── NavMenu.razor.css
│ │ ├───📂 Pages
│ │ │ ├─── Counter.razor
│ │ │ ├─── Error.razor
│ │ │ ├─── Home.razor
│ │ │ └─── Weather.razor
│ │ ├─── _Imports.razor
│ │ ├─── App.razor
│ │ └─── Routes.razor
│ ├───📂 Properties
│ │ └─── launchSettings.json
│ ├───📂 wwwroot
│ │ ├───📂 bootstrap
│ │ │ ├─── bootstrap.min.css
│ │ │ └─── bootstrap.min.css.map
│ │ ├─── app.css
│ │ └─── favicon.png
│ ├─── appsettings.Development.json
│ ├─── appsettings.json
│ ├─── MyFirstAspireApp.Web.csproj
│ ├─── Program.cs
│ └─── WeatherApiClient.cs
└─── MyFirstAspireApp.sln
.NET Aspire project template will create four projects.
- ProjectName.ApiService: This ASP.NET Core Minimal API project serves as the data provider for the front end. It relies on the shared ProjectName.ServiceDefaults project.
- ProjectName.AppHost: As the orchestrator project, it is designed to interconnect and configure various projects and services within your application. Set this orchestrator as the Startup project, and it has dependencies on both ProjectName.ApiService and ProjectName.Web projects.
- ProjectName.ServiceDefaults: A shared .NET Aspire project responsible for managing configurations reused across your solution’s projects. It handles aspects related to resilience, service discovery, and telemetry.
- ProjectName.Web: This ASP.NET Core Blazor App project comes with default .NET Aspire service configurations and depends on the ProjectName.ServiceDefaults project.










J SPosted Dec 1, 2023, 10:13 AM
Very flat...