WF Migration Overview
Status: Final Draft, .NET 4 Beta 2
Last Modified: 9/24/2018 9:45:04 PM

Introduction

In the .NET Framework 4, Microsoft is releasing the second major version of Windows Workflow Foundation (WF). WF was released in .NET 3.0 (this included the types in the System.Workflow.* namespaces; let’s call this WF3) and enhanced in .NET 3.5. WF3is also part of the .NET Framework 4, but it exists therealongside new workflow technology (this includes the types in the System.Activities.* namespaces; let’s call thisWF4).

The purpose of this paper is to describe the relationship between WF3 and WF4, and the choices you have as a user or a potential user of workflow technology in .NET4.

The scope of this paper is broad and as such it presents an overview. Companion documentswill drill into specific topics. Some of these companion documents are currently availablealong with this overview document; others will be released along the way to .NET4 RTM.

The latest version of these documents can be found at

Companion documents will include:

  • WF Migration: Best Practices
    How to design WF3 artifacts so they are more easily migratable to WF4
  • WF Guidance: Rules
    Discussion of how to bring rules-related investments forward into .NET4
  • WF Guidance: State Machine

Discussion of WF4 control flow modeling in the absence of a StateMachine activity

  • WF Guidance: Workflow Services

Examples and instructions for redesigning WF3 workflow services on WF4

  • WF Migration Cookbook: Custom Activities

Examples and instructions for redesigning WF3 custom activities on WF4

  • WF Migration Cookbook: Workflows

Examples and instructions for redesigning WF3 workflows on WF4

  • WF Migration Cookbook: Advanced Custom Activities

Examples and instructions for redesigning advanced WF3 custom activities on WF4

Background

WF3 introduced.NET developers to a new way of building and executing programs. These programs, typically called workflows, are compositions ofactivities which define the control flow and the logic of the program. Their execution is managed by a specialized runtime for workflows built on top of the CLR.

Since its initial release as part of .NET 3.0, the WF3 technology has seen considerable adoption and we have received much feedback, both positive and critical,from our customers and prospective customers. In .NET 3.5 we enhanced WF in an incremental fashion, centering onthe key scenario of WF/WCF integration (the implementation ofWCF services using workflows), commonly known as “workflow services.”

The .NET4 release of WF has, from the beginning, had two fundamental high level objectives:

  1. Maintain full application compatibility: all WFsolutions built on .NET 3.0 and 3.5must run, without requiring redesign or source artifact migration, on .NET4.
  1. Address customer feedback and enhance the capabilities of WF, particularlyaround:customer adoption blockers; key missing features and usability issues; utilization of complementary .NET technologies.

The first objective cannot be compromised, as it residessquarely withinthe overall application compatibility goals of the .NET Framework.

Given this, the team could address goal #2 either by continuing to make incremental (non-breaking) changes on top of the WF3technology, or by developing new workflow technology.

After analysis of pros and cons, the team chose the latter approach. This in part reflects the magnitude andbreaking nature of the changes the team wished to make (and customers asked us to make); chief among these are:

  • Comprehensive adoption of a “fully declarative authoring” approach; this encompasses several key objectives, among them:
  • Enhancement of the activity model to include data modeling (activity variables and arguments) and data flow (expressions)
  • Alignment with the Microsoft “Oslo” vision of modeled applications
  • Utilizationof complementary .NET technologies (which was not possible or deemed out of scope in the prior releases of WF), including:
  • Windows Communication Foundation (WCF) messaging(investments beyond what was done in .NET 3.5)
  • Windows Communication Foundation serialization
  • Windows Presentation Foundation (WPF)
  • XAML (unification with WPF)
  • LINQ Expressions

This “break from the past” approach will certainly leavesomeWF3 customers concerned. The team acknowledges that the breaking nature of WF4 presents migration challenges for WF3 customers, and we are committed to providing guidance and samples to help customers successfully overcome these challenges.

WF Application Compatibility

When considering when to adopt WF4, it is important to first recognize that you control the timing.

  • WF3 is a fully supported part of .NET 4
  • WF3 solutionsrun on .NET4without modification and continue to be fully supported
  • New WF3 solutions can be created and your existing solutions can be edited in VisualStudio2010 and are fully supported

Thus, the decision to adopt the .NET Framework 4 is decoupled from your decision to move to WF4 (System.Activities.*) from WF3 (System.Workflow.*).

WF Artifact Migration

Given that WF3 -> WF4 is a breaking change (they are independent assemblies and APIs), you will have to redesign WF3 artifacts if you want to use them in WF4 (see the section below on the WF4 Interop activity for an important exception to this).

We will be providing a set of documents that help you redesign your WF3 artifacts.

  • Some of these documents are “cookbooks” in which you will find concrete examples and detailed step by step instructions for converting a WF3 artifact into a WF4 equivalent.
  • Other documents are “guidance” in which you will find discussion of a situation where a straightforward WF3 -> WF4 mapping does not exist (or you have multiple options).
  • We are also providing a set of “best practices” so that customers who continue developing WF3 solutions can do so in ways that will minimize the cost and complexity of future migration to WF4.

Please see the Introduction section of this document for a list of companion documents.

AutomatedWorkflow Migration

In addition to documentation support, it is possible that Microsoft may providea tool to do an initial conversion of WF3 workflow definitions to WF4 workflow definitions. This migration could potentiallyinclude the workflow definition’s activity tree, associated declarative conditions, and certain code-beside fields and properties. Code beside logic (event handlers and other methods)will need to be repackaged in the form of custom activities (or replaced by out of the box WF4 activities). It is therefore a WF3 best practice (from a migration perspective) to not utilize CodeActivity, and to not handle custom events defined by WF3 activities.

Please stay tuned for further details about a workflow migration tool. Updates will be posted to the WF team blog (

WF4 Interop Activity

WF4 includes an out of the box activity named Interop. The purpose of the Interop activity is to execute a WF3 activity or workflow (a non-abstract class deriving from System.Workflow.ComponentModel.Activity) within a WF4 activity or workflow. Properties (inputs and outputs) of a WF3 activity are surfaced as arguments by the Interop activity; because they appear as arguments, they can be assigned expressions just like arguments on any WF4 activity.

Please see the .NET4 SDK ( documentation and sample usage of the Interop activity.

Summary

In summary, you have a set of choices about how and when to adopt WF4.

  • Application compatibility ensures that current WF3 investments can be carried forward to .NET4. Adherence to best practices will help minimize the cost of future migration to WF4.
  • The WF4 Interop activity allows you to leverage WF3 artifacts within WF4 solutions.
  • Documentation in the form of “cookbooks” and “guidance” will assist efforts to redesign WF3 artifacts for WF4.
  • Tooling support for automatic conversion of WF3 workflow definitions to WF4 workflow definitions is currently being investigated.

Please send us your feedback and questions related to WF migration. We look forward to helping you successfully adopt and utilize WF4 technology.

Additional Information

  • Visual Studio 2010 -
  • MSDN Dev Center: WF 4–
  • .NET Framework 4 -
  • WF 4 Migration Guidance -
  • WCF and WF Samples for .NET Framework -
  • WCF and WF 4 Training Kit -

The information contained in this document relates to pre-release software product, which may be substantially modified before its first commercial release. Accordingly, the information may not accurately describe or reflect the software product when first commercially released. This document is provided for informational purposes only, and Microsoft makes no warranties, express or implied, with respect to this document or the information contained in it.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

2009 Microsoft Corporation. All rights reserved.

Microsoft, Windows, Visual Studio, and the .NET logo are trademarks of the Microsoft group of companies.All other trademarks are property of their respective owners.

WF Migration Overview (.NET 4 - Beta 2 Release)Page 1