|
| 1 | +# Set up your machine to use the latest Aspire builds |
| 2 | + |
| 3 | +These instructions will get you set up with the latest build of Aspire. If you just want the last preview release of .NET Aspire, the packages are on nuget.org, and install the latest [Visual Studio 2022 version 17.9 Preview](https://visualstudio.microsoft.com/vs/preview/) for the tooling. |
| 4 | + |
| 5 | +## Prepare the machine |
| 6 | + |
| 7 | +See [machine-requirements.md](machine-requirements.md). |
| 8 | + |
| 9 | +## Add necessary NuGet feeds |
| 10 | + |
| 11 | +The latest builds are pushed to a special feed, which you need to add: |
| 12 | +```sh |
| 13 | +dotnet nuget add source --name dotnet8 https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json |
| 14 | +``` |
| 15 | + |
| 16 | +As usual this will add the feed to any existing NuGet.config in the directory or above, or else in the global NuGet.config. See [configuring NuGet behavior](https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior) to read more about that. |
| 17 | + |
| 18 | +Alternatively, if you are using Visual Studio, you can [Install and manage packages in Visual Studio](https://learn.microsoft.com/nuget/consume-packages/install-use-packages-visual-studio#package-sources) and add the feed `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json` there. |
| 19 | + |
| 20 | +## Install the .NET Aspire dotnet workload |
| 21 | + |
| 22 | +This will actually get Aspire components. |
| 23 | + |
| 24 | +```shell |
| 25 | +dotnet workload install aspire --skip-sign-check --interactive --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json |
| 26 | +# To update it later if you wish |
| 27 | +# dotnet workload update --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json |
| 28 | +``` |
| 29 | + |
| 30 | +Now you are ready to create and run an Aspire app using these latest Aspire components. |
| 31 | + |
| 32 | +## Create a new Project |
| 33 | + |
| 34 | +Create an empty .NET Aspire project on the command line: |
| 35 | +```shell |
| 36 | +dotnet new aspire |
| 37 | +# Alternatively, to create a .NET Aspire project using the Starter template: |
| 38 | +# dotnet new aspire-starter |
| 39 | +``` |
| 40 | + |
| 41 | +These will create a `.sln` file and at least two projects. |
| 42 | + |
| 43 | +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` |
| 44 | +```shell |
| 45 | +dotnet restore |
| 46 | +dotnet build |
| 47 | +``` |
| 48 | + |
| 49 | +And then run it (make sure that Docker desktop is started): |
| 50 | +```shell |
| 51 | +dotnet run --project "<directoryname>.AppHost" |
| 52 | +``` |
| 53 | + |
| 54 | +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 <kbd>F5</kbd> to debug or <kbd>Ctrl+F5</kbd> to launch without debugging. |
0 commit comments