Fact-checked by Grok 2 weeks ago

Windows Workflow Foundation

Windows Workflow Foundation (WF) is a Microsoft technology included in the .NET Framework that enables developers to create, execute, and manage as models of real-world processes composed of elemental units called activities. It provides an model, an in-process workflow engine, and a rehostable designer for building workflow-based applications that handle short- or long-running work involving human or system interactions. Workflows in WF define the order of execution and dependencies among activities, allowing for resumption and persistence to support durable, stateful processes. Introduced as part of the .NET Framework 3.0 in November 2006, WF was designed to simplify the orchestration of business processes and integrate seamlessly with other .NET technologies such as (WCF) for service-oriented workflows. A major rewrite occurred in .NET Framework 4.0 (released in 2010), which introduced a more intuitive activity-based model, improved performance, and easier authoring through XAML or code, making workflows simpler to create, execute, and maintain compared to earlier versions. Subsequent enhancements in .NET Framework 4.5 (2012) added features like C# expressions, debugging improvements, and contract-first workflow services. Key components of WF include activities as the building blocks (e.g., activities like Sequence or , and built-in activities for messaging or data handling), the runtime engine that manages instance execution and , and hosting options such as WorkflowInvoker for lightweight, synchronous execution or WorkflowApplication for asynchronous, bookmark-resumable workflows. It supports with console applications, , Windows Services, , and WCF services, running within any Windows process and enabling concurrent instances for scalable applications. Tools like the Workflow Designer in provide visual authoring, while samples and tutorials from demonstrate scenarios such as human workflows, machines, and service orchestration. As of 2025, WF remains part of the .NET Framework, which continues to receive security updates and maintenance but is not included in cross-platform .NET versions (e.g., .NET 5 and later), limiting its use to Windows environments and recommending alternatives like custom state machines or third-party libraries for new .NET projects targeting modern platforms. Despite this, WF powers legacy systems in enterprise scenarios, and can still be targeted in ongoing .NET Framework development for its mature workflow capabilities.

History and Development

Origins and Initial Release

Windows Workflow Foundation (WF) is a technology designed for defining, executing, and managing workflows within .NET applications, providing a extensible programming model for workflow-enabled software. It was first announced by at the Professional Developers Conference (PDC) in September 2005 as a core component of the upcoming .NET Framework 3.0 release. The technology was integrated into .NET Framework 3.0, which became generally available on November 21, 2006. The primary motivations for developing WF centered on addressing challenges in modern application design, particularly the need to separate from underlying application code to improve and . This separation allows developers to model processes declaratively, using composable activities rather than imperative code, which enhances readability and enables non-developers to participate in workflow design. Additionally, WF was engineered to support long-running processes by incorporating built-in persistence and state management, allowing workflows to survive application restarts or extend over extended periods without custom implementation. In its initial release with .NET Framework 3.0, WF supported two primary workflow models: sequential workflows, which execute activities in a linear order, and state machine workflows, which model processes based on discrete states and transitions triggered by events. The framework included a set of basic built-in activities, such as for executing custom code and for introducing timed waits, forming the foundation for more complex compositions. Early adoption of WF occurred within Microsoft's own ecosystem, notably integrating with (WCF) for workflow-enabled services and Windows Presentation Foundation (WPF) for user interface-driven processes, all as part of the unified .NET Framework 3.0 platform.

Evolution Through .NET Framework Versions

Windows Workflow Foundation (WF) underwent several key enhancements across .NET Framework versions following its initial release, focusing on improved usability, integration, and scalability for workflow orchestration. With the release of .NET Framework 3.5 in November 2007, WF introduced features like enhanced workflow tracking for better monitoring and debugging of workflow instances, as well as support for partial classes that enabled developers to customize workflow code more effectively without overriding generated code. These additions built on the foundational sequential and state machine models, making WF more suitable for complex enterprise applications. The .NET Framework 4.0, launched in April 2010, marked a major overhaul of WF, introducing workflow services that tightly integrated with (WCF) for service-oriented workflows, and support for rehosting the workflow designer outside to facilitate custom tools and environments. These changes emphasized declarative workflow authoring and improved performance, positioning WF as a core component for building resilient, long-running processes. In August 2012, .NET Framework 4.5 further refined WF by incorporating C# 5.0 asynchronous programming support, allowing workflows to handle async operations natively for better responsiveness in I/O-bound scenarios, and enabling contract-first workflow development where service contracts could be defined upfront to generate corresponding workflow activities. Post-2012, Microsoft shifted its focus for WF toward maintenance and security updates rather than new feature development, influenced by the growing emphasis on cloud-native architectures and that favored lighter, distributed orchestration tools like Azure Logic Apps. This transition reflected broader industry trends away from monolithic workflow engines toward scalable, event-driven systems. WF's integration with other .NET technologies was exemplified by its role in Windows Server AppFabric, released in 2010, which provided robust hosting, persistence, and monitoring capabilities for WF workflows, enabling durable execution across server restarts and distributed environments. In terms of community and enterprise impact, WF saw significant adoption in Microsoft products such as SharePoint 2010 for document approval and collaboration workflows, and Dynamics CRM for automating customer relationship processes. Despite the rise of modern alternatives, WF continues to power legacy systems in various enterprises as of 2025, with community efforts like the CoreWF project porting WF runtime to .NET 6 and later for extended compatibility.

Technical Architecture

Core Components and Models

Windows Workflow Foundation (WF) provides a set of core components and models that enable the orchestration of long-running, asynchronous processes within .NET applications. At its foundation, WF revolves around the concept of activities, which are the basic units of execution representing discrete steps or operations in a workflow. These activities can be composed hierarchically to form more complex workflows, allowing developers to model business logic declaratively rather than imperatively through traditional code. The runtime engine manages the execution of these workflows, handling persistence, tracking, and coordination across distributed systems. WF supports three primary workflow models to accommodate different execution paradigms. The Sequential Workflow model executes activities in a linear, predetermined order, progressing from start to completion unless interrupted by exceptions or conditions. This model is ideal for straightforward, procedural processes where the flow is predictable and non-branching. In contrast, the State Machine Workflow model is event-driven, consisting of states connected by transitions triggered by external events or internal conditions; it remains idle in a state until an event occurs, making it suitable for scenarios involving user interactions or system notifications. Introduced in WF 4.0, the Flowchart Workflow model offers a visual, graph-based approach with branching and looping constructs, enabling more flexible similar to traditional flowchart diagrams while supporting both sequential and conditional logic. Central to WF's operation are key concepts that ensure reliability in distributed and long-running environments. A workflow instance represents the runtime embodiment of a workflow definition, encapsulating the current state, variables, and execution context; multiple instances can run concurrently from the same definition, each isolated and trackable. Bookmarks serve as mechanisms for asynchronous waiting, allowing a workflow to suspend execution and resume later when an external message or event arrives, which is crucial for handling delays in services like approvals or notifications. Compensation addresses error recovery in long-running processes by enabling rollback logic; it involves defining compensating activities that reverse the effects of prior activities, ensuring transactional integrity even in non-atomic operations across systems. WF's extensibility model empowers developers to create custom activities by inheriting from the base Activity , which provides for inputs, outputs, and execution logic. These custom activities can encapsulate reusable business rules or integrations, such as calling a or processing data. To integrate with visual like Workflow Designer, custom activities often include DesignerMetadata attributes that specify metadata for layout, icons, and property editing, facilitating drag-and-drop authoring without compromising runtime performance. For illustration, consider a simple sequential workflow that logs a message, waits for user input via a bookmark, and then processes the response. The pseudocode below outlines the execution flow:
Workflow Definition:
  Sequence {
    WriteLine Activity: "Workflow started"
    Receive Activity: WaitForInput (Bookmark: "UserResponse")
    If (Input == "Approve") {
      WriteLine Activity: "Approved"
    } Else {
      Compensate: Rollback previous steps
      WriteLine Activity: "Rejected"
    }
    WriteLine Activity: "Workflow completed"
  }

Runtime Execution:
  1. Instantiate workflow from definition
  2. Schedule initial [Sequence](/page/Sequence) activity
  3. Execute WriteLine: Outputs "Workflow started"
  4. Schedule Receive: Suspends and creates [bookmark](/page/Bookmark) "UserResponse"
  5. On external message to [bookmark](/page/Bookmark): Resume, validate input
  6. Branch to conditional activities based on input
  7. If compensation triggered: Invoke compensating logic in reverse order
  8. Complete instance and persist state
This example demonstrates how sequential execution integrates and compensation for robust, interruptible flows.

Activities, Services, and Hosting

Activities in Windows Workflow Foundation (WF) represent the fundamental units of executable behavior within a , encapsulating specific actions or logic that can be composed to form complex processes. Built-in activities include elements such as for sequential execution, for concurrent branching, If for conditional logic, and ForEach for iterating over collections. Other built-in activities handle messaging and data manipulation, like Receive for input operations, Send for output, and Assign for setting variable values. Composite activities, which are themselves workflows composed of child activities, enable hierarchical structuring; for instance, a activity can nest multiple child activities in order, while a activity schedules its children to run simultaneously on separate threads when possible. Custom activities allow developers to extend WF by deriving from base classes like Activity or NativeActivity, incorporating validation rules to enforce constraints on inputs and properties during design-time authoring. Runtime services in WF manage the execution environment, providing essential functionality for workflow instances. The WorkflowRuntime class, in earlier versions, serves as the core hosting engine, initializing services like scheduling, persistence, and tracking upon startup. Tracking participants monitor workflow execution by capturing events such as activity completion or faults, with the built-in ETWTrackingParticipant writing records to Event Tracing for Windows (ETW) sessions for diagnostics. Persistence services enable state saving for long-running workflows, using implementations like SqlWorkflowInstanceStore to store instance data in a SQL Server database, supporting features such as unloading instances to free memory while allowing later resumption. Hosting options for WF workflows vary based on application needs, supporting both short-lived and durable scenarios. In-process hosting via WorkflowInvoker suits lightweight, synchronous execution of short-lived workflows without requiring full runtime management, invoking the workflow as a simple method call. For web-hosted environments, integration with IIS or the Windows Activation Service (WAS) uses to expose workflows as WCF services, handling activation, persistence, and communication over protocols like HTTP. Custom rehosting allows embedding WF in client applications, such as WinForms or console apps, by manually managing instances for greater control over lifecycle events. Performance considerations in WF focus on efficient resource utilization, particularly for scalable deployments. The employs a single-threaded execution model by default for each instance, ensuring predictable behavior while leveraging for non-blocking operations to avoid thread exhaustion. Idle timeouts, configurable through properties like WorkflowIdleBehavior, determine when workflows persist or unload during inactivity, balancing memory usage with quick resumption. Throttling limits, such as MaxConcurrentInstances in hosting environments, prevent overload by capping the number of active instances, adjustable via host configurations to match system capacity.

Versions and Features

.NET Framework 3.0 and 3.5

Windows Workflow Foundation (WF) was introduced as a core component of the .NET Framework 3.0, released in November 2006, providing a , engine, and tools for building workflow-enabled applications. In .NET Framework 3.5, released in November 2007, WF received enhancements such as improved tracking, better integration with (WCF), and expanded activity libraries, while maintaining the foundational from 3.0. These versions emphasized sequential, state machine, and data-driven workflow models, enabling developers to model long-running processes within Windows applications. Developers instantiate the WorkflowRuntime class to host , often using a to manage a single runtime instance and configure services, allowing programmatic hosting without recreating the runtime in every scenario. For external data exchange, WF relies on interfaces marked with the ExternalDataExchangeAttribute, registered via the ExternalDataExchangeService added to the WorkflowRuntime; this enables local communication between the workflow and host applications through events and operations, such as raising events from external code to influence workflow execution. Integration with a rules engine is facilitated by the PolicyActivity, which executes RuleSet objects defined declaratively in .rules files, allowing to be separated from workflow code and updated without recompilation. Despite these capabilities, WF in 3.0 and 3.5 had notable limitations, including support only for imperative XAML loading—where XAML-defined workflows must be loaded and executed via code using classes like WorkflowMarkupSerializer—without declarative execution directly from XAML files. There was no built-in designer support for rehosting outside 2007, requiring custom implementation for non-IDE environments. Additionally, compilation of code-based or XAML-derived workflows depended on CodeDom providers, such as CSharpCodeProvider, which generated and compiled intermediate C# code at , introducing performance overhead and dependency on the hosting environment's availability. For backward compatibility, WF treats compiled workflows as black boxes, ensuring that existing instances continue executing without modification as long as public types in the workflow definition remain unchanged across versions; this versioning strategy relies on assembly binding and public contract stability to avoid breaking deployed workflows. A representative example of a basic approval workflow in these versions is a sequential workflow that requests approval and branches based on the response. Begin by defining an external data exchange interface, such as IApprovalService, with an event ApprovalReceivedEvent deriving from ExternalDataEventArgs, containing properties like IsApproved (bool) and Comments (string); implement this interface in a host service and register it via ExternalDataExchangeService in the WorkflowRuntime. In the workflow, use a HandleExternalEventActivity to wait for the approval event, setting its EventName to "ApprovalReceived" and InterfaceType to IApprovalService, with the EventData property bound to a workflow variable of type ExternalDataEventArgs. Following this, add an IfElseActivity to check the IsApproved property: in the true branch, include a CodeActivity to log approval and complete the workflow (e.g., via a custom CompleteWorkflowActivity); in the false branch, add another CodeActivity to handle rejection, perhaps looping back or terminating. To execute, use the WorkflowRuntime to create the instance, add the service, and instantiate the workflow type with parameters if needed; from the host, raise the event using the service implementation to simulate approval, triggering the HandleExternalEventActivity and subsequent branching. This structure demonstrates how WF 3.0/3.5 handles asynchronous external interactions and conditional logic without advanced persistence or compensation features.

.NET Framework 4.0

Windows Workflow Foundation (WF) in .NET Framework 4.0, released in April 2010, represented a major redesign aimed at improving usability, performance, and integration with other .NET technologies, shifting from a compile-time model to a more dynamic, -focused architecture. This version introduced native support for XAML, enabling declarative authoring without requiring compilation, which simplified and allowed workflows to be treated as data. The overhaul emphasized modularity, with workflows now composable at , facilitating easier testing, , and extension compared to . Key enhancements included the introduction of WorkflowServiceHost, a hosting environment that seamlessly integrates WF with (WCF) services, supporting features like multiple workflow instances, persistence, tracking, and messaging patterns. This host could be self-hosted in applications or web-hosted via IIS or the Windows Activation Service using .xamlx files, streamlining the exposure of workflows as services. Additionally, rehosted designers allowed developers to embed the Workflow Designer outside of , using it as a controls library in custom applications for tailored authoring experiences. WF 4.0 introduced new workflow models to enhance expressiveness and flexibility. Flowchart activities provided a visual, imperative control flow alternative to sequential workflows, supporting constructs like loops and conditional branches without inherent concurrency, making it suitable for procedural logic. Contract-based workflows, facilitated by the WorkflowService class and messaging activities such as Receive, SendReply, Send, and ReceiveReply, enabled workflows to interact with WCF services based on service contracts, promoting loose coupling and service-oriented design. Tooling improvements focused on developer productivity. The Workflow Designer was rearchitected as a reusable controls , integrable into non-Visual Studio environments, while IntelliSense support in provided real-time assistance for activity authoring, validation, and property editing. For , WF 4.0 supported side-by-side execution with WF 3.5 workflows through separate assemblies—System.Workflow. for version 3.5 and System.Activities. for 4.0—allowing both to run concurrently in the same application without conflicts. Migration from 3.5 to 4.0 involved redesign due to breaking changes, but provided guidance documents, including the WF Migration Overview and Cookbooks for workflows and custom activities, along with the Interop activity to embed 3.5 activities within 4.0 workflows; an automated conversion was also anticipated for workflow definitions.

.NET Framework 4.5

The .NET Framework 4.5 release, which occurred on August 15, 2012, marked the final major feature update for Windows Workflow Foundation (WF), introducing refinements aimed at enhancing developer productivity and integration with emerging language capabilities. This version built upon the foundational changes in WF 4.0 by incorporating support for C# 5's async/await keywords within custom activities, allowing developers to author asynchronous operations more naturally without blocking workflow execution. Specifically, the AsyncCodeActivity base class was enhanced to leverage async/await patterns, enabling cleaner handling of I/O-bound tasks like web service calls or database operations directly in activity code. A key productivity enhancement was the introduction of contract-first workflow development, which permitted developers to define service contracts in code before generating corresponding workflow activities. This approach utilized a built-in tool to automatically create activity templates from the contract, streamlining the integration of workflows with WCF services and reducing manual wiring. The tool employed T4 text templating to produce customizable XAML-based activity skeletons, ensuring type-safe implementations and facilitating reuse across projects. Additionally, debugging capabilities were improved with support for workflow breakpoints on non-activity elements, such as State objects in state machine workflows, allowing developers to pause execution during transitions for more granular troubleshooting. Tooling updates in Visual Studio 2012 further elevated the authoring experience, with the workflow designer gaining features like auto-connect and auto-insert for flowcharts and state machines, which automatically arranged and linked activities to simplify layout management. The designer also supported the new dark theme introduced in Visual Studio 2012, providing better visibility for expressions and annotations in low-light environments while maintaining compatibility with that offered full IntelliSense support. Other refinements included pan mode for navigating large workflows, multi-select for batch operations, and an outline view for hierarchical navigation, all contributing to faster iteration during development. Performance optimizations focused on runtime efficiency, including faster instance activation through improved workflow versioning mechanisms that allowed dynamic updates without full reloading. Memory management for large workflows was enhanced by separating view state into dedicated XAML sections, reducing overhead during serialization and deserialization, and introducing the NoPersistScope activity to exclude sensitive or transient data from persistence stores. These changes ensured better scalability for long-running processes, though no further feature releases followed this version, positioning WF 4.5 as the culmination of its evolution within the .NET Framework.

Usage Scenarios

Business Process Management

Windows Workflow Foundation (WF) enables the orchestration of complex business processes by modeling them as sequences of activities that encapsulate decision logic, approvals, and interactions. In business process management, WF facilitates the automation of structured workflows, such as those involving multiple stakeholders and conditional routing based on rules. For instance, WF's rules engine allows developers to define declarative policies that evaluate conditions and influence process flow, ensuring consistent application of business logic without hardcoding decisions into the workflow itself. A common scenario for WF in is order processing workflows that incorporate approval chains and interactions. In an order-processing , WF uses mechanisms to create a new instance for incoming orders and route subsequent updates—such as status changes or modifications—to the correct existing instance via a like an order ID. This supports multi-step approval chains, where parallel activities solicit approvals from different departments, pausing execution until external events signal completion, such as a manager's approval via a Receive activity with a . These interactions are essential for scenarios requiring intervention, like verifying compliance before proceeding. WF integrates with enterprise tools like BizTalk Server to extend orchestration capabilities, particularly by embedding WF rules for decision logic in message-based processes. BizTalk can invoke WF workflows to handle human-centric or rule-driven steps within broader integrations, allowing seamless orchestration of business rules alongside system messages. This combination supports scalable process automation where WF provides the flexibility for dynamic decisions. Key benefits of WF in include robust audit trails through its built-in tracking infrastructure and enhanced for high-volume transactions. Workflow tracking automatically emits records for lifecycle events, such as activity starts and completions, enabling the extraction of business data like order details for compliance auditing and analytics without modifying the code. For , WF4's asynchronous and optimized achieve high throughput—up to 153,000 workflows per second for simple sequences—making it suitable for enterprise-scale operations with persistent across distributed environments. In , WF has been applied in workflows, such as processing systems that enforce regulatory checks and handle exceptions. A representative case involves enterprise workflows where WF orchestrates approval chains for , using fault handlers to catch and manage exceptions like incomplete , ensuring with regulatory standards by routing issues to appropriate teams via compensation logic. This approach provides durable execution and traceability, reducing risk in high-stakes financial processes.

Integration and Automation

Windows Workflow Foundation (WF) facilitates integration between heterogeneous systems by enabling workflows to orchestrate calls to Windows Communication Foundation (WCF) endpoints, allowing developers to compose durable, message-driven service interactions. In this context, WF workflows act as coordinators that receive incoming messages via WCF bindings, process them through sequential or state machine models, and route responses or invoke subsequent services, supporting scenarios like distributed transaction management across endpoints. This tight integration with WCF extends WF's reach to service-oriented architectures, where workflows can be exposed as WCF services hosted in IIS or self-hosted environments. Custom activities in WF provide extensibility for technical tasks, such as extract-transform-load (ETL) processes, where developers create reusable components to handle data extraction from sources like databases, apply transformations using .NET code, and load results into target systems. These activities can encapsulate complex logic, including error handling and retry mechanisms, making WF suitable for automating data pipeline without tightly to specific data providers. By deriving from base classes like CodeActivity or NativeActivity, such custom activities integrate seamlessly into broader workflows, enhancing in integration scenarios. For automation, WF supports background job scheduling through activities like Delay (in WF4) or TimerActivity (in earlier versions), which pause workflow execution until a specified time interval elapses, enabling timed triggers for repetitive tasks such as or resource cleanup. This capability allows workflows to model asynchronous, event-driven automations, including integrations with , where WF powers event receivers that respond to list item changes, document approvals, or site events by initiating workflows that propagate updates across connected systems. In environments, these event-driven workflows leverage WF's hosting model to automate and collaboration flows triggered by user actions or system events. WF's extensibility further supports binding workflows to message queues, particularly through WCF's NetMsmqBinding, which enables queued communication using (MSMQ) for decoupled, reliable message delivery. Developers can host WF services in a WorkflowServiceHost and configure queue-based endpoints to process incoming messages asynchronously, ensuring workflows handle high-volume integrations like order processing or event aggregation without losing during outages. This binding mechanism, often implemented via project templates like WorkflowServiceLibrary, allows workflows to subscribe to queue topics and correlate messages across instances. In legacy contexts, WF imposes threading constraints that impact I/O-bound , as each workflow instance executes on a single to maintain execution order and , potentially leading to bottlenecks in scenarios involving prolonged waits for external resources like calls or operations. This single-threaded model per instance, while simplifying synchronization, requires careful design of asynchronous activities to avoid blocking the host , and developers must rely on and bookmarks to unload workflows during idle I/O periods. Such limitations highlight the need for hybrid approaches in high-throughput , combining WF with external queuing for better .

Authoring and Development

Visual Design Tools

The primary visual design tool for Windows Workflow Foundation (WF) is the Workflow Designer integrated into , available in starting from 2008 and supported through 2022 (as of 2025), which enables developers to construct workflows graphically using drag-and-drop functionality. This designer provides a canvas where users can assemble activities from the , a palette containing built-in and custom activity designers, allowing for intuitive placement and connection of workflow elements without writing code. Key features include the Properties grid, which facilitates runtime configuration of selected activities, variables, and arguments through a familiar interface, and real-time validation that highlights errors with visual indicators such as squiggly underlines on invalid expressions or connections. The Workflow Designer supports rehosting, permitting its embedding into custom user interfaces outside of , such as in WPF applications or third-party tools, to provide tailored design experiences while retaining core functionality like activity authoring and debugging. For instance, rehosting allows developers to create domain-specific editors by leveraging the designer's extensibility model, including custom activity designers and validation services. Visual designs created in the Workflow Designer generate XAML markup as output, serializing the workflow structure into an XML-based representation using classes like ActivityXamlServices for declarative persistence. This XAML file defines the workflow's activities, arguments, and flow, often incorporating the x:Class directive to form a partial that integrates with code-behind files for adding custom logic or handlers in C# or . Best practices for using the visual designer emphasize leveraging project and item templates in to create reusable workflow designs, such as starting with a or template to standardize common patterns and promote across applications. This approach facilitates and maintenance by encapsulating repeatable activity compositions, reducing redundancy, and ensuring consistency in architecture.

Programmatic Creation

Programmatic creation of workflows in Windows Workflow Foundation (WF) involves authoring workflow definitions directly in code, typically using C#, which enables dynamic generation and customization at . This approach is particularly suited for scenarios where workflows need to be constructed based on conditions, integrated with other components, or extended beyond visual designers. Developers instantiate activity objects, configure their properties, and compose them into hierarchical structures to define execution flow, without relying on XAML markup or graphical tools. Custom activities form the building blocks of programmatic workflows and are created by deriving from base classes such as NativeActivity. This base class provides access to the runtime context via NativeActivityContext, allowing developers to schedule child activities, create for asynchronous operations, and implement custom logic by overriding the Execute method. For instance, a custom activity might read user input asynchronously by creating a bookmark and resuming it upon completion. The CacheMetadata method is overridden to declare arguments, variables, and delegates, ensuring validation during workflow compilation. Workflows are assembled imperatively by creating instances of built-in activities like or and adding child activities, , and arguments. , declared as Variable, store data within scopes, while arguments (InArgument, OutArgument, etc.) facilitate data flow between the workflow and its host. Expressions for , such as CSharpValue for read-only values, are used to compute values dynamically; these compile to expression trees at for evaluation in the workflow environment, supporting complex data binding without hard-coded values. For execution, WorkflowApplication hosts the workflow definition, enabling compilation, handling (e.g., for completion or idling), and dynamic resumption via bookmarks. This contrasts with simpler synchronous via WorkflowInvoker, which suits short-lived workflows but lacks persistence support. Dynamic execution extends programmatic creation by loading workflow definitions from XAML strings at , allowing flexible reconfiguration. Using ActivityXamlServices.Load with a StringReader parses the XAML into a DynamicActivity, which can then be invoked via WorkflowApplication or WorkflowInvoker, with inputs passed as dictionaries. Custom logic is integrated by overriding the Execute method in derived activities or injecting expressions. For advanced scenarios, C# expressions in code-based workflows require explicit compilation using TextExpressionCompiler to generate executable expression trees. of workflows leverages WorkflowInvoker.Invoke for synchronous execution in isolated contexts, validating outputs and exceptions without full hosting; this method simulates method-like calls, making it ideal for verifying logic in non-persistent workflows. The following example demonstrates a dynamic sequence workflow created in C#, incorporating variables and arguments:
csharp
using System;
using System.Activities;
using System.Collections.Generic;
using System.Activities.Statements;
using Microsoft.CSharp.Activities;

public sealed class SimpleWorkflow : Activity
{
    public SimpleWorkflow()
    {
        this.Implementation = () =>
        {
            Variable<int> number = new Variable<int> { Default = 0 };
            InArgument<int> inputArg = new InArgument<int>("InputNumber");
            OutArgument<int> resultArg = new OutArgument<int>("Result");

            return new Sequence
            {
                Variables = { number },
                Activities =
                {
                    new WriteLine { Text = new CSharpValue<string>(() => "Starting workflow") },
                    new Assign<int>
                    {
                        To = number,
                        Value = new CSharpValue<int>(env => inputArg.Get(env) * 2)
                    },
                    new WriteLine { Text = new CSharpValue<string>(env => $"Doubled value: {number.Get(env)}") },
                    new Assign<int> { To = resultArg, Value = number }
                }
            };
        };
    }
}

// Usage with WorkflowInvoker for testing or simple execution
Dictionary<string, object> inputs = new Dictionary<string, object> { { "InputNumber", 5 } };
Dictionary<string, object> outputs = WorkflowInvoker.Invoke(new SimpleWorkflow(), inputs);
Console.WriteLine($"Result: {outputs["Result"]}");  // Outputs: 10
This code defines a workflow that doubles an input argument using a variable and C# expressions for binding, executed synchronously to return the result.

Current Status and Legacy

Support in Modern .NET Ecosystems

Windows Workflow Foundation (WF) maintains a legacy status within the .NET ecosystem, remaining exclusively available in the .NET Framework up to version 4.8, which was released in April 2019. It has not been ported to .NET Core or subsequent unified .NET versions starting from .NET 5, with Microsoft explicitly stating that WF is unsupported in these modern platforms. This exclusion was clarified in Microsoft's documentation accompanying the .NET 5 release in November 2020, building on earlier indications during the .NET Core development phase around 2016 that certain Framework-specific technologies like WF would not migrate. As a result, WF applications are confined to the .NET Framework runtime, limiting their deployment to Windows environments without cross-platform capabilities inherent to .NET Core and later. In terms of ongoing maintenance, WF receives security patches and servicing updates through the .NET Framework's integration with , aligned with the support lifecycle of the host operating system. For instance, .NET Framework 4.8 continues to be serviced as part of updates. For , support is available through the Extended Security Updates (ESU) program beyond October 14, 2025. .NET Framework 4.6.2 support extends to January 12, 2027. However, no new features or enhancements have been added to WF since .NET Framework 4.5 in 2012, positioning it as a stable but stagnant component suitable primarily for on-premises applications running on supported versions. This setup ensures viability for maintaining existing WF-based systems without immediate disruption, provided they remain on compatible .NET Framework installations. WF persists in enterprise environments, particularly within legacy systems such as (CRM) solutions and workflows, where it underpins long-standing business processes. Microsoft's official guidance recommends retaining WF for sustaining current workflows in .NET Framework applications but advises against its adoption for new or development projects, favoring modern alternatives better suited to cross-platform and cloud-native scenarios. This approach underscores WF's role as a maintained technology rather than a forward-looking foundation in the evolving .NET landscape as of 2025.

Migration Paths and Alternatives

Organizations seeking to transition from Windows Workflow Foundation (WF) often extract for deployment in cloud-based services like Apps or Power Automate, where existing WF activities can be manually recreated using visual designers and connectors. This approach leverages over 1,400 pre-built connectors in Apps for with external systems, enabling scalable, serverless execution without the need for on-premises . Alternatively, refactoring WF workflows into custom state machines within modern .NET applications involves breaking down sequential and state-based into or event-driven architectures, utilizing libraries for persistence and . Key challenges in WF migration include the lack of native support for WF in .NET Core or later versions, necessitating complete redesigns rather than direct porting, and difficulties in preserving persistence for long-running workflows that span days or weeks. Handling asynchronous states and restartability requires custom implementations, as WF's built-in tracking and compensation mechanisms do not translate seamlessly to cloud-native environments. Tools for converting WF XAML definitions to BPMN standards are limited, often requiring manual mapping using general-purpose modelers like or bpmn.io, which support BPMN 2.0 but lack WF-specific importers. Modern alternatives to WF include open-source .NET libraries such as CoreWF, a port of the WF runtime to .NET 6 and later by , providing compatibility for workflow execution in cross-platform environments. Elsa Workflows offers a composable activity model inspired by WF but compatible with .NET 6 and later, supporting visual design, definitions, and persistence via Core for long-running processes. Similarly, Workflow Core provides a , embeddable engine for .NET Standard, enabling fluent API-based workflows with pluggable persistence and concurrency for multi-node setups. For low-code options within the ecosystem, the Power Platform—particularly Power Automate—replaces legacy WF-based workflows with features like parallel branching, scheduled triggers, and AI-assisted authoring, outperforming classic models in flexibility and analytics. Cross-platform needs can be addressed by , an open-source orchestration platform that excels in scheduling and monitoring complex data pipelines using Python-defined DAGs, with scalability for enterprise environments. Enterprise case studies illustrate these transitions; for instance, a major bank in 2022 replaced a WF-based system in Windows AppFabric—handling over 200 workflows for account transfers—with a decoupled architecture, extracting to enable future cloud migration to Functions or Logic Apps, thereby avoiding a full rewrite and addressing risks by April 2022. This effort preserved existing code value while preparing for elastic scaling, demonstrating post-2020 gains in maintainability amid .NET Framework end-of-support pressures.

References

  1. [1]
    Windows Workflow Overview - .NET Framework - Microsoft Learn
    Sep 15, 2021 · This article describes Workflow Foundation workflows, which are models that describe real-world processes.
  2. [2]
    Windows Workflow Foundation - .NET Framework - Microsoft Learn
    Sep 15, 2021 · This article contains resources that describe the programming model, samples, and tools of the Windows Workflow Foundation.Windows Workflow Foundation... · Windows Workflow... · Guide to the Windows...
  3. [3]
    What's New in Windows Workflow Foundation - .NET Framework
    Sep 15, 2021 · Learn about Windows Workflow Foundation changes in .NET Framework 4. Workflows are easier to create, execute, and maintain.
  4. [4]
    What's New in Windows Workflow Foundation in .NET Framework 4.5
    Sep 15, 2021 · Windows Workflow Foundation (WF) in .NET Framework 4.5 introduces many new features, such as new activities, designer capabilities, and workflow development ...
  5. [5]
    Should You Use Windows Workflow Foundation in 2026? - Inedo Blog
    Jul 10, 2025 · Windows Workflow Foundation (WF) is not part of the current .NET (.NET 5 to .NET 10). That does not mean that Microsoft killed it though.
  6. [6]
    MS Announces Windows Workflow Foundation
    Sep 1, 2005 · Microsoft announced Windows Workflow Foundation, the Expression family of design tools, and Visual Studio Tools for Applications at PDC 2005.
  7. [7]
    Microsoft releases .Net Framework 3.0 - Computerwoche
    Nov 7, 2006 · Microsoft's .Net Framework 3.0, featuring the company's latest innovations in Web services, presentation and workflow, is now available to ...
  8. [8]
    [PDF] The Workflow Way: Understanding Windows Workflow Foundation
    logic unified, making it more understandable, while still letting the application scale. Achieving this is a primary goal of Windows Workflow Foundation (WF).Missing: key motivations
  9. [9]
    Building State Machines with Windows Workflow Foundation
    Sep 10, 2019 · This article discusses: Sequential workflows vs. state machine workflows; When to use state machine workflows; Building and designing state ...
  10. [10]
    Windows Workflow Foundation (WF) sample documentation - .NET Framework
    ### Summary of Business Process Workflow Samples
  11. [11]
    Windows Workflow Foundation - ASP.NET Community Blogs
    Aug 31, 2006 · It provides an in-process workflow engine to process rules, a designer for VS 2005 to enable both developers and non-developers to define custom ...<|separator|>
  12. [12]
    .NET Framework version history - Wikipedia
    . NET Framework 3.0, formerly called WinFX, was released on 6 November 2006. It includes a new set of managed code APIs that are an integral part of Windows ...
  13. [13]
    Rehosting the Workflow Designer - .NET Framework - Microsoft Learn
    Sep 15, 2021 · The Windows Workflow Designer can be rehosted in environments outside of Visual Studio 2012 for the purposes of creating, modifying, and monitoring workflows.
  14. [14]
    Contract First Workflow Service Development - .NET Framework
    Sep 15, 2021 · Starting with .NET Framework 4.5, Windows Workflow Foundation (WF) features better integration between web services and workflows in the ...Operation Contract... · Message Contract Attributes · Fault Contract AttributesMissing: async | Show results with:async
  15. [15]
    Scalable, Long-Running Workflows with Windows Server AppFabric
    Windows Server AppFabric is a set of extensions for Windows Server that includes caching and hosting services for services based on Windows Communication ...
  16. [16]
    How to: Host a Workflow Service with Windows Server App Fabric
    Sep 15, 2021 · Select the Workflow Persistence tab. This allows you to configure your application to use App Fabric's default persistence provider as shown in ...
  17. [17]
    What's deprecated or removed from SharePoint Server Subscription ...
    Mar 11, 2025 · SharePoint 2010 workflows are deprecated but will remain supported for the SharePoint Server Subscription Edition release until July 14, 2026.Infopath Forms Services · Microsoft Workflow Manager · Basic Authentication
  18. [18]
    Windows Workflow Foundation Feature Specifics - .NET Framework
    Nov 6, 2021 · This article describes new features that .NET Framework 4 adds to Windows Workflow Foundation and scenarios in which the features might be ...Correlation · Flowchart · Wcf Routing Service
  19. [19]
    How to: Create an Activity - .NET Framework - Microsoft Learn
    Jul 29, 2022 · This article shows you how to create two activities in Workflow Foundation: one that uses code to implement its logic and one defined by ...<|control11|><|separator|>
  20. [20]
    Tracking Participants - .NET Framework - Microsoft Learn
    Sep 15, 2021 · Windows Workflow Foundation (WF) in .NET Framework 4.6.1 provides a tracking participant that writes the tracking records to an ETW session.Tracking Participants · ETW Tracking Participant
  21. [21]
    SQL Workflow Instance Store - .NET Framework - Microsoft Learn
    Sep 15, 2021 · The .NET Framework 4.6.1 ships with the SQL Workflow Instance Store, which allows workflows to persist state information about workflow instances.
  22. [22]
    Using WorkflowInvoker and WorkflowApplication - .NET Framework
    Oct 4, 2022 · Windows Workflow Foundation (WF) provides several methods of hosting workflows. WorkflowInvoker provides a simple way for invoking a workflow ...Missing: options | Show results with:options
  23. [23]
    Workflow Service Host Internals - WCF - Microsoft Learn
    Sep 15, 2021 · This property will limit the number of concurrent workflow service instances. When this throttle is exceeded any additional requests for new ...
  24. [24]
    Hosting Workflows - .NET Framework - Microsoft Learn
    Sep 15, 2021 · Workflow Hosting Options Describes how to select the appropriate host for your workflows. Using WorkflowInvoker and WorkflowApplication
  25. [25]
    Windows Workflow Foundation 4 Performance - .NET Framework
    Dec 21, 2022 · This article explains performance characteristics of the major revision of Windows Workflow Foundation, which is part of .NET Framework 4.
  26. [26]
    What's new in .NET Framework - Microsoft Learn
    Jan 6, 2023 · Windows Presentation Foundation (WPF)​​ In . NET Framework 4.8, WPF adds support for Per-Monitor V2 DPI Awareness and Mixed-Mode DPI scaling.
  27. [27]
    Cutting Edge: A Tour of Windows Workflow Activities - Microsoft Learn
    Windows Workflow Foundation comes with a large set of built-in activities, but it is also completely extensible through custom activities.
  28. [28]
    ExternalDataExchangeService Class (System.Workflow.Activities)
    Represents a service that must be added to the workflow run-time engine for local services communications to be enabled. Local service implementations are ...Missing: external | Show results with:external
  29. [29]
    PolicyActivity Class (System.Workflow.Activities) - Microsoft Learn
    For more information, see Deprecated Types in Windows Workflow Foundation 4.5. Constructors. Expand table. PolicyActivity(). Initializes a ...
  30. [30]
    Introduction to XAML in Windows Workflow Foundation - CodeProject
    Apr 13, 2007 · One can design workflow in three possible ways using Workflow Foundation; purely code based, partially code/XAML based, and totally XAML based.
  31. [31]
    Guide to the Windows Workflow Documentation - .NET Framework
    Sep 15, 2021 · This article contains information about how to use the Windows Workflow Foundation documentation, grouped according to interests and levels ...
  32. [32]
    Windows Workflow: Rules and Conditions
    Sep 1, 2006 · WF will read the resource at runtime and use classes in the System.CodeDom.Compiler namespace to generate and compile source code from the XAML.Working With Conditions · Working With Rules · The Policy ActivityMissing: limitations | Show results with:limitations
  33. [33]
    Foundations - Versioning Workflows - Microsoft Learn
    In this month's column, I will discuss the core issues related to workflow versioning and provide my recommendations for making changes to workflow definitions, ...Missing: external exchange
  34. [34]
  35. [35]
    Migration Guidance - .NET Framework - Microsoft Learn
    Sep 15, 2021 · Provides example-oriented step-by-step instructions for redesigning workflows that implement Windows Communication Foundation (WCF) web services ...
  36. [36]
    None
    ### Key Points on Migration from WF 3.5 to 4.0
  37. [37]
    Announcing the release of .NET Framework 4.5 RTM - Product and ...
    Aug 15, 2012 · Updated – 8/16/2012: Added license information about the source code release. Today, we are happy to announce the availability of Microsoft .NET ...<|separator|>
  38. [38]
    Creating Asynchronous Activities in WF - .NET Framework
    Sep 15, 2021 · This topic provides an overview of how to create custom asynchronous activities using AsyncCodeActivity.Missing: 4.5 | Show results with:4.5
  39. [39]
    The Task Asynchronous Programming (TAP) model with async and ...
    You can find a complete Windows Presentation Foundation (WPF) example available for download from Asynchronous programming with async and await in C#. C#Missing: Workflow | Show results with:Workflow
  40. [40]
    Create a workflow service that consumes an existing service contract
    Jun 8, 2024 · The contract-first workflow development tool allows you to design the contract in code first. The tool then automatically generates an activity template.Missing: async | Show results with:async
  41. [41]
    Support for New Workflow Foundation 4.5 Features in the Rehosted ...
    In addition to flowchart and sequential workflow development models, this release includes State Machine workflows, and contract-first workflow services. State ...Missing: initial | Show results with:initial
  42. [42]
    Change fonts, colors, and themes in Visual Studio - Microsoft Learn
    Jul 25, 2025 · In the options list, select Environment > General. In the Color theme list, select either the default Dark theme, the Light theme, the Blue ...Change The Color Theme · Change Fonts And Text Size · Preserve Font Settings...
  43. [43]
    The HandleExternalEvent Activity in Windows Workflow - InfoQ
    Jun 22, 2006 · Scott Allen walks through the implementation of a HandleExternal Event Activity in Windows Workflow Foundation that is used to handle events ...Missing: human- | Show results with:human-
  44. [44]
    BizTalk and Windows Workflow Foundation - Which and When To ...
    Mar 30, 2009 · In a very simple way: Use Windows Workflow Foundation → Workflow within applications and human workflow; Use BizTalk Server → Workflow ...
  45. [45]
    Biztalk, Windows Workflow Foundation and Business Rules - FICO
    Windows Workflow Foundation (WWF) is targeted at applications that will host workflows where Biztalk is aimed at orchestration within the server. In addition ...Missing: WF | Show results with:WF
  46. [46]
    Workflow Tracking and Tracing - .NET Framework - Microsoft Learn
    Sep 15, 2021 · Tracking Participants Describes how to use system-provided tracking participant or how to create custom tracking participants. Configuring ...
  47. [47]
    Architecting Enterprise Loan Workflows and Orchestrations
    ... Windows Workflow Foundation (WF). Orchestration of consistent business rules. WPF can reduce the training time of loan executives, officers, underwriters ...
  48. [48]
    Exceptions, Transactions, and Compensation - .NET Framework
    Sep 15, 2021 · Workflows can use a combination of exception handlers, transactions, cancellation, and compensation to handle and recover gracefully from error conditions.Missing: fault | Show results with:fault<|separator|>
  49. [49]
    Workflow services overview - WCF - Microsoft Learn
    Sep 15, 2021 · Workflow services are workflows that use the messaging activities to send and receive Windows Communication Foundation (WCF) messages.
  50. [50]
    MSDN Magazine: Windows Workflow - Securing WF 4 Workflow ...
    ... workflow services as well. Frameworks like Windows Identity Foundation (WIF) integrate with WCF at the dispatcher level, and these can transparently be used ...
  51. [51]
    Designing and Implementing Custom Activities - .NET Framework
    Nov 6, 2021 · This article provides resources for creating custom activities in Workflow Foundation by creating composite activities or creating new activityMissing: ETL processes
  52. [52]
    SharePoint workflow fundamentals - Microsoft Learn
    Mar 20, 2023 · The workflow platform in SharePoint uses the Windows Workflow Foundation 4 activity model to represent a SharePoint-based business process.Overview Of Workflows In... · Platform Architecture · Starting Workflows
  53. [53]
    Queuing in WCF - Microsoft Learn
    Sep 15, 2021 · The queued transport in WCF uses MSMQ for its queued communication. MSMQ ships as an optional component with Windows and runs as an NT service.
  54. [54]
    Queues in Windows Communication Foundation - WCF
    Mar 29, 2023 · To use the queues feature in a WCF application, you can use one of the standard bindings, or you can create a custom binding if one of the ...
  55. [55]
    Developing Applications with the Workflow Designer - Visual Studio ...
    Mar 11, 2024 · The Workflow Designer is a visual designer and debugger for the graphical construction and debugging of Windows Workflow Foundation (WF) applications in Visual ...
  56. [56]
    ExpressionTextBox Class (System.Activities.Presentation.View)
    In the hostable editor, pretty listing, colorization, and squiggling occurs before you begin editing. To bind the expression text box to OwnerActivity, use ...
  57. [57]
    Serializing Workflows and Activities to and from XAML
    Sep 15, 2021 · This article is an overview of serializing workflow definitions and working with XAML workflow definitions in Workflow Foundation.
  58. [58]
    x:Class Directive - XAML - Microsoft Learn
    Mar 8, 2022 · Configures XAML markup compilation to join partial classes between markup and code-behind. The code partial class is defined in a separate code file.
  59. [59]
    Workflow Services - Visual Design of Workflows with WCF and WF 4
    WCF workflow services provide a productive environment for authoring long-running, durable operations or services where enforcing an application protocol via ...Workflow Services - Visual... · The Scenario · Asking Vendors For Rates
  60. [60]
    Real-World WF: Best Practices For Windows Workflow Foundation ...
    Some insights into some best (and less-than-best) practices to consider when using WF to realize software solutions in the real world.Missing: early | Show results with:early
  61. [61]
    Authoring Workflows, Activities, and Expressions Using Imperative ...
    Nov 6, 2021 · A Workflow Foundation workflow definition is a tree of configured activity objects. Use code to create workflow definitions, activities, ...
  62. [62]
    NativeActivity Class (System.Activities) - Microsoft Learn
    The following code sample demonstrates creating a class that inherits from NativeActivity<TResult>. This example is from the Custom Composite using Native ...
  63. [63]
    Variables and Arguments - .NET Framework - Microsoft Learn
    This article describes variables, which represent storage of data, and arguments, which represent flow of data to/from an activity in Workflow Foundation.Missing: WorkflowApplication | Show results with:WorkflowApplication
  64. [64]
    C# Expressions - .NET Framework - Microsoft Learn
    Sep 15, 2021 · C# expressions are supported in Windows Workflow Foundation (WF). New C# workflow projects created in Visual Studio 2012 that target .NET Framework 4.5 use C# ...
  65. [65]
    NET Framework technologies unavailable on .NET 6+
    Feb 14, 2024 · Windows Workflow Foundation (WF) is not supported in .NET 6+. For an alternative, see CoreWF. Tip. Windows Communication Foundation (WCF) server ...
  66. [66]
    Microsoft .NET and .NET Core - Microsoft Lifecycle
    End Date .NET 10, Nov 11, 2025, Nov 14, 2028 .NET 9, Nov 12, 2024, Nov 10, 2026 ... Entity Framework support details. Note. Beginning with .NET 5.0 ...
  67. [67]
    Use WWF - Windows Workflow Foundation or Similar Workflow tools ...
    Jun 10, 2024 · Using WWF is not recommended, unless you already have a working solution. WWF is getting left behind in a NET Core world.Windows Workflow Foundation - Microsoft Q&AHow to use workflow foundation in vs2022 ? - Microsoft Q&AMore results from learn.microsoft.com
  68. [68]
    Power Automate migration - Azure Logic Apps - Microsoft Learn
    Jul 18, 2025 · Learn about the benefits and capabilities that you gain when you migrate flows from Microsoft Power Automate to Standard workflows in Azure ...Migration Benefits · Integration And Development · Version Control With...
  69. [69]
    Replace classic Microsoft Dataverse workflows with Power Automate
    Feb 8, 2023 · This topic compares Power Automate capabilities with classic workflow. Power Automate has significant advantages over the classic background workflow model.
  70. [70]
    4 Alternatives to Windows Workflow Foundation - Inedo Blog
    Mar 7, 2023 · Windows Workflow Foundation, aka WF, is no longer supported in the current .NET. While it isn't dead, it certainly isn't thriving. WF is tied to ...<|separator|>
  71. [71]
    Replacing the workflow logic engine for a bank's account transfer ...
    May 23, 2022 · Low Code: The bank could move to Low Code like LogicApps or Azure Functions. However, this would require rearchitecting the whole application.
  72. [72]
    Free BPMN 2.0 Tool - Camunda
    Try Camunda Web Modeler - a free online BPMN tool. Use our BPMN software to create, edit, and share business processes & decision models. Get started today.
  73. [73]
    Web-based tooling for BPMN, DMN, CMMN, and Forms | bpmn.io
    Use bpmn-js to display BPMN 2.0 diagrams on your website. Embed it as a BPMN 2.0 web modeler into your applications and customize it to suit your needs.Bpmn-js examples | Toolkits · Bpmn-js walkthrough | Toolkits · Forum · Blog
  74. [74]
    elsa-workflows/elsa-core: A .NET workflows library - GitHub
    Elsa is a powerful workflow library that enables workflow execution within any .NET application. Elsa allows you to define workflows in various ways.
  75. [75]
    danielgerlag/workflow-core - GitHub
    Workflow Core is a light weight embeddable workflow engine targeting .NET Standard. Think: long running processes with multiple tasks that need to track state.
  76. [76]
    Apache Airflow - The Apache Software Foundation
    Airflow is a platform created by the community to programmatically author, schedule and monitor workflows.Tutorials · Installation of Airflow · Apache-airflow-providers-google · UI Overview