These instructions will get you set up with the latest build of Aspire. If you just want the last release of .NET Aspire, the packages are on nuget.org, and install Visual Studio 2022 version 17.10 or later for the tooling.
Since dogfooding will require using nightly build feeds, you may not want to add feeds globally which could alter how other code on your machine builds. To avoid this happening, you can create a local nuget.config file by running the following command in the root of your repository:
dotnet new nugetconfig
The latest builds are pushed to a special feed, which you need to add:
dotnet nuget add source --name dotnet9 https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json
If you use Package Source Mapping, you'll also need to add the following mappings to your NuGet.config
<packageSourceMapping>
<packageSource key="dotnet9">
<package pattern="Aspire.*" />
<package pattern="Microsoft.Extensions.ServiceDiscovery*" />
<package pattern="Microsoft.Extensions.Http.Resilience" />
</packageSource>
</packageSourceMapping>
To be able to create aspire projects, you will need to install the latest Aspire templates. You can do this by running the following command:
dotnet new install Aspire.ProjectTemplates::*-* --force
Tip
If you want to use the latest build from the release/9.0-rc1
branch, change the above to be dotnet new install Aspire.ProjectTemplates::9.0.0-rc.1.* --force
Note
The --force
parameter is required if you also have the legacy .NET Aspire Workload installed. The new templates have the same name as the old ones, so this command would override those.
Create an empty .NET Aspire project on the command line:
dotnet new aspire
Alternatively, to create a .NET Aspire project using the Starter template:
dotnet new aspire-starter
Tip
If you get an error saying Unable to resolve the template, the following installed templates are conflicting
, append a -9
to the above template names. For example, dotnet new aspire-starter-9
.
These will create a .sln
file and at least two projects.
Assuming the NuGet feed you added above is visible -- for example you added it globally or it's in a NuGet.config in this folder - you can now build that .sln
dotnet restore
dotnet build
And then run it (make sure that Docker desktop is started):
dotnet run --project "<directoryname>.AppHost"
Alternatively, if you are using Visual Studio, you can instead create a new Blazor Web App project and check the Enlist in Aspire orchestration
box while creating it. Then use F5 to debug or Ctrl+F5 to launch without debugging.