Skip to content

Latest commit

 

History

History

AspireWithDapr

languages products page_type name urlFragment description
csharp
dotnet
dotnet-aspire
sample
.NET Aspire dapr sample app
aspire-dapr
A sample .NET Aspire app that shows how to use dapr

.NET Aspire dapr sample app

This is a simple .NET app that shows how to use Dapr with .NET Aspire orchestration.

Demonstrates

  • How to configure a .NET Aspire app to work with Dapr

Sample prerequisites

Dapr installation instructions can be found here. After installing the Dapr CLI, remember to run dapr init as described here.

This sample is written in C# and targets .NET 8.0. It requires the .NET 8.0 SDK or later.

Building the sample

To download and run the sample, follow these steps:

  1. Clone the dotnet/aspire-samples repository.
  2. In Visual Studio (2022 or later):
    1. On the menu bar, choose File > Open > Project/Solution.
    2. Navigate to the folder that holds the sample code, and open the solution (.sln) file.
    3. Right click the AspireWithDapr.AppHost project in the solution explore and choose it as the startup project.
    4. Choose the F5 key to run with debugging, or Ctrl+F5 keys to run the project without debugging.
  3. From the command line:
    1. Navigate to the folder that holds the sample code.
    2. At the command line, type dotnet run.

To run the game, run the .NET Aspire app by executing the following at the command prompt (opened to the base directory of the sample):

dotnet run --project AspireWithDapr.AppHost
  1. On the Resources page, click on one of the endpoints for the listed project. This launches the simple .NET app.
  2. In the .NET app:
    1. Visit the Weather.

For more information about using dapr, see the Dapr documentation.