Create Dapr Workflow .NET Application
Overview
This skill describes how to create a Dapr Workflow application using .NET.
Execution Order
You MUST follow these phases in strict order:
- Prerequisite Checks — Run ALL checks. Stop if any fail.
- Project Setup — Create all files and folders.
- Verify — Verify that the project builds.
- Create README.md — Create a readme that summarizes what is built and how to run & test the application. Do not provide instructions at the end of this phase.
- Show final message - Your LAST output MUST be EXACTLY the message defined in the
## Show final messagesection. Do NOT add any other text, summary, or commentary after it.
Prerequisites
The following must be installed by the user before this skill can run:
Additional runtime dependencies (handled during project setup):
- NuGet package:
Dapr.Workflowversion1.17.4 - NuGet package:
Dapr.Workflow.Versioningversion1.17.4 - Start the Diagrid Dev Dashboard:
docker run -p 8080:8080 ghcr.io/diagridio/diagrid-dashboard:latest
Prerequisite Checks
IMPORTANT: Run ALL of these checks BEFORE creating any files or folders. If any check fails, stop and inform the user with the relevant install link from the Prerequisites section. Do NOT proceed to Project Setup until all checks pass.
Step 1: Check the C# LSP plugin
Read the file at ../shared/prereq-check-csharp-lsp.md and follow those instructions.
Step 2: Detect Operating System
Read the file at ../shared/prereq-detect-os.md and follow those instructions.
Step 3: Check .NET SDK
Read the file at ../shared/prereq-check-dotnet-sdk.md and follow those instructions.
Step 4: Check Docker or Podman
Read the file at ../shared/prereq-check-docker-podman.md and follow those instructions.
Step 5: Check Dapr CLI
Read the file at ../shared/prereq-check-dapr-cli.md and follow those instructions.
Project Setup
Create the project root folder inside the current location where the terminal is open, then create a new ASP.NET Core web application inside it:
mkdir <ProjectRoot>
cd <ProjectRoot>
dotnet new web -n <ProjectName>
dotnet add <ProjectName> package Dapr.Workflow --version 1.17.4
dotnet add <ProjectName> package Dapr.Workflow.Versioning --version 1.17.4
The should start with the and end with App: App.
Folder structure
<ProjectRoot>/
├── .gitignore
├── dapr.yaml
├── local.http
├── resources/
│ └── statestore.yaml
└── <ProjectName>/
├── <ProjectName>.csproj
├── Program.cs
├── Properties/
│ └── launchSettings.json
├── Models/
│ └── <ModelName>.cs
├── Workflows/
│ └── <WorkflowName>.cs
└── Activities/
└── <ActivityName>.cs
.gitignore
Visual Studio style .gitignore file in the project root. Ignores build output (bin, obj), debug/release folders, and other common .NET artifacts. See REFERENCE.md for full example.
dapr.yaml
Multi-app run file in the project root. Configures the Dapr sidecar and points to the resources folder. See REFERENCE.md for full example and key points.
resources/statestore.yaml
Dapr Workflow requires a state store component (with actorStateStore set to "true"). See REFERENCE.md for full example and key points.
Properties/launchSettings.json
Configures the application port, which must match appPort in dapr.yaml. See REFERENCE.md for full example.
.csproj
Standard ASP.NET Core web project targeting net10.0 with the Dapr.Workflow and Dapr.Workflow.Versioning packages. See REFERENCE.md for full example.
Models
Record types for workflow and activity input/output, placed in a Models folder. Must be serializable since Dapr persists workflow state. See REFERENCE.md for full example and key points.
Program.cs
Uses AddDaprWorkflow to register workflow and activity types. Uses DaprWorkflowClient to schedule workflow instances and query status via HTTP endpoints. See REFERENCE.md for full example and key points.
Workflow Class
Inherits from Workflow<TInput, TOutput>, overrides RunAsync, and orchestrates activities via context.CallActivityAsync. Must be internal sealed. Place in a Workflows folder/namespace. See REFERENCE.md for full example, key points, determinism rules, and workflow patterns (chaining, fan-out/fan-in, sub-workflows).
Activity Class
Inherits from WorkflowActivity<TInput, TOutput>, overrides RunAsync, and contains the actual business logic. Must be internal sealed. Place in an Activities folder/namespace. See REFERENCE.md for full example and key points.
local.http
HTTP request file for testing the workflow endpoints. Contains a start request (POST) to schedule a new workflow instance and a status request (GET) to query the workflow state. Uses the <app-port> from launchSettings.json. See REFERENCE.md for full example.
Verify
IMPORTANT: After Project Setup you MUST show these exact verification instructions:
- Run
dotnet buildon the csproj file to check for build errors. - Instruct the user to start the application with
dapr run -f .in the project root to start the workflow app.
Create README.md
IMPORTANT: After Verify you MUST run these instructions:
Create a README.md file inside the folder.
The README contains the following sections:
- Summary of what this folder contains.
- Architecture description that explains the technology stack and prerequisites to run it locally. DO NOT suggest to run Redis separately since it's part of the Dapr installation and is running in a container already.
- A mermaid diagram that explains the workflow.
- How to start the application using the Dapr CLI.
- List the available endpoints in the Program.cs file and provide examples how to call these using curl. Also include a link to the
local.httpfile. - How to inspect the workflow execution using the Diagrid Dev Dashboard.
- How to run the application with Diagrid Catalyst to visually inspect the workflow.
See REFERENCE.md for additional instructions on running locally and running with Catalyst.
Show final message
IMPORTANT: This is the LAST step. After Create README.md, your final output MUST be ONLY the message below — no preamble, no summary, no additional commentary, only replace the with the actual value:
The workflow application is created. Open the README.md file in the folder for a summary and instructions for running locally.