Microsoft.DurableTask.Generators 2.0.0-preview.1

Prefix Reserved
This is a prerelease version of Microsoft.DurableTask.Generators.
dotnet add package Microsoft.DurableTask.Generators --version 2.0.0-preview.1
                    
NuGet\Install-Package Microsoft.DurableTask.Generators -Version 2.0.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.DurableTask.Generators" Version="2.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.DurableTask.Generators" Version="2.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.DurableTask.Generators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.DurableTask.Generators --version 2.0.0-preview.1
                    
#r "nuget: Microsoft.DurableTask.Generators, 2.0.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.DurableTask.Generators@2.0.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.DurableTask.Generators&version=2.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.DurableTask.Generators&version=2.0.0-preview.1&prerelease
                    
Install as a Cake Tool

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:

  1. 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
  2. Fallback Detection: If no trigger attributes are found, checks if Microsoft.Azure.Functions.Worker.Extensions.DurableTask is 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 above
  • Functions: Forces generation of Azure Functions-specific code
  • Standalone: Forces generation of standalone Durable Task Worker code (includes AddAllGeneratedTasks method)
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

There are no supported framework assets in this package.

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