Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Using a custom activity

.NET Framework 4.6 and 4.5

Activities that derive from Activity or its subclasses can be composed into larger workflows, or created directly in code. This topic describes how to use custom activities in workflows created either in code or in the designer.

Custom activities can be used in the same project in which they are defined, as long as both the custom activity and the activity that uses it are compiled (i.e. loaded by an instantiating type generated by the build process) If the referencing activity is loaded dynamically (e.g. using ActivityXAMLServices), then the referenced assembly should be placed in a different project, or the designer-generated XAML needs to be hand-edited to enable this.

Using a custom activity to a workflow project

  1. Add a reference from the host project to the activity library project containing the custom activity.

  2. Build the solution.

  3. To use the custom activity in the designer, locate the custom activity in the toolbox, and drag the activity onto the designer surface.

  4. To use the custom activity in code, add a Using statement that refers to the custom activity project, and pass a new instance of the activity to Invoke.

Build Date:

© 2015 Microsoft