This documentation is archived and is not being maintained.

Workflow Activity Authoring Using the Activity Class

This topic applies to Windows Workflow Foundation 4 (WF4).

The most basic way to create an activity using Windows Workflow Foundation (WF) in .NET Framework version 4 is to create a class that inherits from Activity that creates functionality by assembling custom activities or activities from the .NET Framework 4 Built-In Activity Library. This topic demonstrates how to create an activity that writes two messages to the console.

To create a custom Activity using the activity designer

  1. Open Visual Studio 2010.

  2. Select File, New, Project. Select Workflow 4.0 under Visual C# in the Project Types window, and select the v2010 node. Select Activity Library in the Templates window. Name the new project HelloActivity.

  3. Open the new activity. Drag a Sequence activity from the toolbox onto the designer surface.

  4. Drag a WriteLine activity into the Sequence activity. Enter “Hello World” (with quotes) into the Text field.

  5. Drag a second WriteLine activity into the Sequence activity, below the first one. Enter “Goodbye” (with quotes) into the Text field.

Show: