Skip to content

Move Dapr to community toolkit #3393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@
{
"source_path_from_root": "/docs/deployment/azure/local-provisioning.md",
"redirect_url": "/dotnet/aspire/azure/local-provisioning"
},
{
"source_path_from_root": "/docs/frameworks/dapr.md",
"redirect_url": "/dotnet/aspire/azure/dapr"
}
]
}
20 changes: 12 additions & 8 deletions docs/frameworks/dapr.md → docs/community-toolkit/dapr.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
title: NET Aspire Dapr integration
description: Learn how to use the .NET Aspire Dapr integration, which can configure and orchestrate Dapr from a .NET Aspire app host project.
ms.date: 01/16/2025
ms.date: 05/12/2025
uid: frameworks/dapr
---

# .NET Aspire Dapr integration

[!INCLUDE [includes-hosting](../includes/includes-hosting.md)]

[!INCLUDE [banner](includes/banner.md)]

[Distributed Application Runtime (Dapr)](https://docs.dapr.io/) offers developer APIs that serve as a conduit for interacting with other services and dependencies and abstract the application from the specifics of those services and dependencies. Dapr and .NET Aspire can work together to improve your local development experience. By using Dapr with .NET Aspire, you can focus on writing and implementing .NET-based distributed applications instead of local on-boarding.

In this guide, you'll learn how to take advantage of Dapr's abstraction and .NET Aspire's opinionated configuration of cloud technologies to build simple, portable, resilient, and secured microservices at scale.
Expand All @@ -30,9 +34,9 @@ At first sight Dapr and .NET Aspire may look like they have overlapping function

Dapr provides many [built-in components](https://docs.dapr.io/concepts/components-concept), and when you use Dapr with .NET Aspire you can easily explore and configure these components. Don't confuse these components with .NET Aspire integrations. For example, consider the following:

- [Dapr—State stores](https://docs.dapr.io/concepts/components-concept/#state-stores): Call <xref:Aspire.Hosting.IDistributedApplicationBuilderExtensions.AddDaprStateStore%2A> to add a configured state store to your .NET Aspire project.
- [Dapr—Pub Sub](https://docs.dapr.io/concepts/components-concept/#pubsub-brokers): Call <xref:Aspire.Hosting.IDistributedApplicationBuilderExtensions.AddDaprPubSub%2A> to add a configured pub sub to your .NET Aspire project.
- Dapr—Components: Call <xref:Aspire.Hosting.IDistributedApplicationBuilderExtensions.AddDaprComponent%2A> to add a configured integration to your .NET Aspire project.
- [Dapr—State stores](https://docs.dapr.io/concepts/components-concept/#state-stores): Call `AddDaprStateStore` to add a configured state store to your .NET Aspire project.
- [Dapr—Pub Sub](https://docs.dapr.io/concepts/components-concept/#pubsub-brokers): Call `AddDaprPubSub` to add a configured pub sub to your .NET Aspire project.
- Dapr—Components: Call `AddDaprComponent` to add a configured integration to your .NET Aspire project.

## Install Dapr

Expand All @@ -47,18 +51,18 @@ This integration requires Dapr version 1.13 or later. To install Dapr, see [Inst

## Hosting integration

In your .NET Aspire solution, to integrate Dapr and access its types and APIs, add the [📦 Aspire.Hosting.Dapr](https://www.nuget.org/packages/Aspire.Hosting.Dapr) NuGet package in the [app host](xref:dotnet/aspire/app-host) project.
In your .NET Aspire solution, to integrate Dapr and access its types and APIs, add the [📦 CommunityToolkit.Aspire.Hosting.Dapr](https://www.nuget.org/packages/CommunityToolkit.Aspire.Hosting.Dapr) NuGet package in the [app host](xref:dotnet/aspire/app-host) project.

### [.NET CLI](#tab/dotnet-cli)

```dotnetcli
dotnet add package Aspire.Hosting.Dapr
dotnet add package CommunityToolkit.Aspire.Hosting.Dapr
```

### [PackageReference](#tab/package-reference)

```xml
<PackageReference Include="Aspire.Hosting.Dapr"
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Dapr"
Version="*" />
```

Expand All @@ -70,7 +74,7 @@ For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-pac

Dapr uses the [sidecar pattern](https://docs.dapr.io/concepts/dapr-services/sidecar/). The Dapr sidecar runs alongside your app as a lightweight, portable, and stateless HTTP server that listens for incoming HTTP requests from your app.

To add a sidecar to a .NET Aspire resource, call the <xref:Aspire.Hosting.IDistributedApplicationResourceBuilderExtensions.WithDaprSidecar%2A> method on it. The `appId` parameter is the unique identifier for the Dapr application, but it's optional. If you don't provide an `appId`, the parent resource name is used instead.
To add a sidecar to a .NET Aspire resource, call the `WithDaprSidecar` method on it. The `appId` parameter is the unique identifier for the Dapr application, but it's optional. If you don't provide an `appId`, the parent resource name is used instead.

:::code language="csharp" source="snippets/Dapr/Dapr.AppHost/Program.cs" range="1-7" highlight="7":::

Expand Down
2 changes: 1 addition & 1 deletion docs/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ conceptualContent:
url: /samples/dotnet/aspire-samples/orleans-voting-sample-app-on-aspire/
- itemType: overview
text: Use Dapr with .NET Aspire
url: frameworks/dapr.md
url: community-toolkit/dapr.md
- itemType: sample
text: Dapr integration sample
url: https://github.com/CommunityToolkit/Aspire/tree/main/examples/dapr
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/aspire-faq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ sections:

Where Dapr abstracts some of the underlying cloud platform, .NET Aspire provides opinionated configuration around the underlying cloud technologies without abstracting them. A .NET-based application that uses Dapr can use .NET Aspire to orchestrate the local developer inner loop and streamline deployment. .NET Aspire includes extensions that support the launching of Dapr side-car processes during the inner loop.

For more information, see [Use Dapr with .NET Aspire](../frameworks/dapr.md) and the corresponding [Dapr sample app](https://github.com/dotnet/aspire-samples/tree/main/samples/AspireWithDapr) in the .NET Aspire sample repository.
For more information, see [Use Dapr with .NET Aspire](../community-toolkit/dapr.md) and the corresponding [Dapr sample app](https://github.com/dotnet/aspire-samples/tree/main/samples/AspireWithDapr) in the .NET Aspire sample repository.

- question: |
How does .NET Aspire differ from Project Tye?
Expand Down
8 changes: 2 additions & 6 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ items:
href: /dotnet/api/?term=Aspire.Hosting.Azure&view=dotnet-aspire-9.2&preserve-view=true
- name: Aspire.Azure API reference
href: /dotnet/api/?term=Aspire.Azure&view=dotnet-aspire-9.2&preserve-view=true
- name: Dapr
items:
- name: Overview
href: frameworks/dapr.md
- name: Dapr integration sample
href: https://github.com/CommunityToolkit/Aspire/tree/main/examples/dapr
- name: Elasticsearch
displayName: elasticsearch,search
href: search/elasticsearch-integration.md
Expand Down Expand Up @@ -323,6 +317,8 @@ items:
href: community-toolkit/hosting-azure-static-web-apps.md
- name: Bun apps
href: community-toolkit/hosting-bun.md
- name: Dapr
href: community-toolkit/dapr.md
- name: Deno apps
href: community-toolkit/hosting-deno.md
- name: Go apps
Expand Down