![]() |
VOOZH | about |
dotnet add package Microsoft.DurableTask.Generators --version 2.1.0-preview.2
NuGet\Install-Package Microsoft.DurableTask.Generators -Version 2.1.0-preview.2
<PackageReference Include="Microsoft.DurableTask.Generators" Version="2.1.0-preview.2" />
<PackageVersion Include="Microsoft.DurableTask.Generators" Version="2.1.0-preview.2" />Directory.Packages.props
<PackageReference Include="Microsoft.DurableTask.Generators" />Project file
paket add Microsoft.DurableTask.Generators --version 2.1.0-preview.2
#r "nuget: Microsoft.DurableTask.Generators, 2.1.0-preview.2"
#:package Microsoft.DurableTask.Generators@2.1.0-preview.2
#addin nuget:?package=Microsoft.DurableTask.Generators&version=2.1.0-preview.2&prereleaseInstall as a Cake Addin
#tool nuget:?package=Microsoft.DurableTask.Generators&version=2.1.0-preview.2&prereleaseInstall as a Cake Tool
Source generators for Microsoft.DurableTask
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.
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
Fallback Detection: If no trigger attributes are found, checks if Microsoft.Azure.Functions.Worker.Extensions.DurableTask is referenced
This automatic detection solves the common issue where transitive dependencies on Functions packages would incorrectly trigger Functions mode even when not using Azure Functions.
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>
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 (includes AddAllGeneratedTasks method)<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.
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 |
Showing the top 1 popular GitHub repositories that depend on Microsoft.DurableTask.Generators:
| Repository | Stars |
|---|---|
|
polymind-inc/acmebot
Automated ACME SSL/TLS certificate management built around Azure Key Vault
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.1.0-preview.2 | 0 | 6/17/2026 |
| 2.1.0-preview.1 | 7,075 | 3/17/2026 |
| 2.0.0-preview.1 | 23,913 | 2/3/2026 |
| 1.0.0-preview.1 | 1,068,686 | 11/30/2022 |
| 0.4.1-beta | 53,829 | 5/20/2022 |