Workflow Activity Authoring Using the Activity Class

The most basic way to create an activity using Windows Workflow Foundation (WF) in .NET Framework 4.6.1 is to create a class that inherits from Activity that creates functionality by assembling custom activities or activities from the 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 2012.

  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.