Enabling .NET Aspire
Let’s add .NET Aspire to this solution. Using Visual Studio, you can select the Games API project in Solution explorer and use the context menu to select Add | .NET Aspire Orchestrator Support….
Note
Instead of using Visual Studio, you can use the dotnet CLI to create a .NET Aspire project: dotnet new aspire
. With the two projects created, you can connect the Games API project using the explanations from this section.
This creates two projects ({solution}.AppHost
and {solution}.ServiceDefaults
) and makes small changes to the Games API project. The AppHost
project is a web application that runs a dashboard to monitor all the configured services. ServiceDefaults
is a library to specify default configurations. This library is referenced by the Games API. Let’s look into the details next.
Exploring the Aspire host
The source code of the startup code of the Aspire host is shown here:
Codebreaker.AppHost/Program.cs
var builder...