Search code examples
c#workflow-foundationxamlx

Can Windows Workflows be written in C# instead of XAML?


We are using Windows Workflow Foundation for our workflows. The XAMLX files that contain workflow definitions are very brittle (they often end-up unopenable for no apparent reason) and we can't work on them in parallel, because we won't be able to merge those changes (underlying XAML is nie-human-readable). I'm looking for ways to alleviate the pains of having to work with XAML via built-in Visual Studio editor. Is it possible to define Windows Workflow Foundation workflows in C#?

This article article in the "Workflow Structure" section suggests that it is possible, but does not give full example.

Final Update Check the answer below for a working sample of code-only C# workflow and config to host it via WCF.


Solution

  • I have compiled together information from different tutorials and came up with a sample project demonstrating Windows Workflow Foundation workflow authored via code-only and hosted as WCF service