Microsoft.DurableTask.Generators
2.0.0-preview.1
Prefix Reserved
dotnet add package Microsoft.DurableTask.Generators --version 2.0.0-preview.1
NuGet\Install-Package Microsoft.DurableTask.Generators -Version 2.0.0-preview.1
<PackageReference Include="Microsoft.DurableTask.Generators" Version="2.0.0-preview.1" />
<PackageVersion Include="Microsoft.DurableTask.Generators" Version="2.0.0-preview.1" />
<PackageReference Include="Microsoft.DurableTask.Generators" />
paket add Microsoft.DurableTask.Generators --version 2.0.0-preview.1
#r "nuget: Microsoft.DurableTask.Generators, 2.0.0-preview.1"
#:package Microsoft.DurableTask.Generators@2.0.0-preview.1
#addin nuget:?package=Microsoft.DurableTask.Generators&version=2.0.0-preview.1&prerelease
#tool nuget:?package=Microsoft.DurableTask.Generators&version=2.0.0-preview.1&prerelease
Source generators for Microsoft.DurableTask
Overview
The Microsoft.DurableTask.Generators package provides source generators that automatically generate type-safe extension methods for orchestrators and activities. The generator automatically detects whether you're using Azure Functions or the Durable Task Scheduler and generates appropriate code for your environment.
Configuration
Project Type Detection
The generator uses intelligent automatic detection to determine the project type:
Primary Detection: Checks for Azure Functions trigger attributes (
OrchestrationTrigger,ActivityTrigger,EntityTrigger) in your code- If any methods use these trigger attributes, it generates Azure Functions-specific code
- Otherwise, it generates standalone Durable Task Worker code
Fallback Detection: If no trigger attributes are found, checks if
Microsoft.Azure.Functions.Worker.Extensions.DurableTaskis referenced- This handles projects that reference the Functions package but haven't defined triggers yet
This automatic detection solves the common issue where transitive dependencies on Functions packages would incorrectly trigger Functions mode even when not using Azure Functions.
Explicit Project Type Configuration (Optional)
In rare scenarios where you need to override the automatic detection, you can explicitly configure the project type using the DurableTaskGeneratorProjectType MSBuild property in your .csproj file:
<PropertyGroup>
<DurableTaskGeneratorProjectType>Standalone</DurableTaskGeneratorProjectType>
</PropertyGroup>
Supported Values
Auto(default): Automatically detects project type using the intelligent detection described aboveFunctions: Forces generation of Azure Functions-specific codeStandalone: Forces generation of standalone Durable Task Worker code (includesAddAllGeneratedTasksmethod)
Example: Force Standalone Mode
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<DurableTaskGeneratorProjectType>Standalone</DurableTaskGeneratorProjectType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DurableTask.Generators" OutputItemType="Analyzer" />
</ItemGroup>
</Project>
With standalone mode, the generator produces the AddAllGeneratedTasks extension method for worker registration:
builder.Services.AddDurableTaskWorker(builder =>
{
builder.AddTasks(r => r.AddAllGeneratedTasks());
});
For more information, see https://github.com/microsoft/durabletask-dotnet
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Microsoft.DurableTask.Generators:
| Package | Downloads |
|---|---|
|
Southport.Azure.Functions.Extensions
Package Description |
|
|
Southport.Azure.Functions.Isolated.Extensions
Initial Release |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Microsoft.DurableTask.Generators:
| Repository | Stars |
|---|---|
|
Azure/azure-functions-durable-extension
Durable Task Framework extension for Azure Functions
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-preview.1 | 202 | 2/3/2026 |
| 1.0.0-preview.1 | 895,816 | 11/30/2022 |
| 0.4.1-beta | 52,860 | 5/20/2022 |