⚠ Deprecated: Other
We will no longer be publishing new versions of this package. We recommend using the CommunityToolkit.Aspire.Hosting.Dapr package going forward.
Suggested alternative: CommunityToolkit.Aspire.Hosting.Dapr
Dapr support for .NET Aspire.
$ dotnet add package Aspire.Hosting.DaprProvides extension methods and resource definitions for a .NET Aspire AppHost to configure Dapr resources.
In your AppHost project, install the .NET Aspire Dapr Hosting library with NuGet:
dotnet add package Aspire.Hosting.Dapr
Then, in the Program.cs file of AppHost, add Dapr resources and consume the connection using the following methods:
var builder = DistributedApplication.CreateBuilder(args);
var stateStore = builder.AddDaprStateStore("statestore");
var pubSub = builder.AddDaprPubSub("pubsub");
builder.AddProject<Projects.MyApp>("myapp")
.WithDaprSidecar()
.WithReference(stateStore)
.WithReference(pubSub);
builder.Build().Run();