As a presenter at Timisoara .NET Meetup #2 I thought it would be interesting to share with the local community some of my experience with a not so known technology from the .NET stack: Windows Workflow Foundation. For this purpose, I built a demo app (source code available on github) and a short introductory presentation for the topic.
The Rehosted Workflow Designer sample application
The goal of this example is to show how easy it is to implement a lot of powerful functionality with very little code. I created a WPF application which allows the user to design, manage & execute Workflows (plus real time execution logging); I also built a demo custom Activity Library & workflow which, via the activities implemented on top of the meetup.com rest api, returns the list of members that attended the meetup 🙂
Full source code is available on github: https://github.com/orosandrei/Rehosted-Workflow-Designer
About Windows Workflow Foundation
WF was introduced with the release of .NET 3 and it was used in Microsoft SharePoint 2007. Since then, the technology got a complete rewrite with .NET 4.0 which brought great performance improvements and by .NET 4.5 it received many updates which also made it easier to integrate in custom solutions.
When to use WF
Windows Workflows Foundation is a powerful technology and it is very useful when dealing with business logic that changes often, long running processes (nice support for persistence), BPMs (it has great support for State Machines & Flowcharts).
Unix scenarios
Currently the WF technology is only available for the Windows platform and it doesn’t look like it will be added to the new cross-platform .Net Core anytime soon. The Mono project started porting WF – it is part of its Olive incubation module, however from the github repository commits it looks like it hasn’t received any updates in the last 2 years.
If you really want to execute actions on Unix servers, there is one possibility #hack 🙂 – you could implement an activity that takes as an input a bash script which gets executed on Unix server via SSH; the result of the execution you can return in an Output parameter of the activity.
The future of Windows Workflow Foundation
Sharepoint 2013 & 2016, BizTalk and Dynamics CRM are Microsoft products that make use of WF, so support & maintenance for the latest version is safe in the next years.
From a development point of view, the technology received many updates with .Net 4.5. The latest .Net 4.6 release only added a small feature – FilterResumeTimeoutInSeconds – and in .Net Core WF is not included (yet). Microsoft seems to have shifted its strategy to favor the Azure cloud workflows services & automation development built on top of the Powershell Workflow runbooks (also WF based) and Azure Logic Apps (launched in march 2015).
- Update 2019
- Update November 2017
- I added
Roslyn based intellisense for Visual Basic custom ExpressionTextbox expressions & I also integrated @DustinMetzgar‘s custom C# expression editor
- I wrote about the state of Windows Workflow Foundation in 2017
- Windows Workflow Foundation port to .net core is now a community effort (CoreWF repository at https://github.com/dmetzgar/corewf ), without official support from Microsoft
- the focus of the WF development team at Microsoft in 2017 is on the .NET Framework (full)
- Workflow Manager (SharePoint)
- some accessibility items to the Workflow Designer
- I added
- Update October 2016:
- Workflow Foundation was also discussed on .NET Rocks! vNext episode 1356 and long term support was again confirmed
- .Net Core port of WF Runtime and ETW tracking https://github.com/dmetzgar/corewf
- Update September 2016: work is being done to Port Workflow Foundation to CoreFx/CoreCLR; see https://github.com/dotnet/corefx/issues/2394#issuecomment-171471805 for business case and https://github.com/dotnet/corefx/issues/2394#issuecomment-244534065 for technical challenges
- Update February 2016: @DustinMetzgar, PM for Workflow Foundation at Microsoft, reached out and said that WF is not abandoned, but was considered Done and that they are supporting / maintaining it in the future as well; they are also getting feedback from the community regarding what features should be added next
References
Windows Workflow Foundation and .Net Core
Windows Workflow Foundation
What’s new in WF 4.5
A Developer’s Introduction to WF
Workflow Manager
Powershell Workflows & Azure Automation
WF 4x Code Samples
.Net Core port of Workflow Foundation Runtime and ETW Tracking
CoreFx/CoreCLR Issue – port of Worflow Foundation
* my Rehosted Workflow Designer on github
* my Introduction to Windows Workflow Foundation, embedded below:
Hi Andrei,
Do you have insight of how to use WWF inside webapplication?
and how to host WWF on IIS?
Hi Ody,
Please see my replies on github https://github.com/orosandrei/Rehosted-Workflow-Designer/issues/2/ , they should point you in the right direction
Hello,
I downloaded the sample application and it compiles and run without any problems. However, when I create and try to save a sequence workflow with a nested for-each activity, and inside the for-each an IF-Else Activity, the saved file will not contain the nested if-else activity. How can I overcome this problem ?
Thanks,
Hratch
Hi Hratch,
Use the activities under the CustomForEach category (see this line MainWindow.xaml.cs#L173); the reason why we need to do this is detailed here
Thanks a lot. It worked. Any other activities I should worry about, or this problem is confined to ForEach and Parallel Foreach only ?
Glad it worked. The rest of the standard activities don’t have this issue.
Is there way to add tabs for multiple flows?
yes, but you need a separate dedicate designer instance for each workflow
How to add debug functionality like step,step in,step over.
see this sample, it showcases exactly that https://learn.microsoft.com/en-us/dotnet/framework/windows-workflow-foundation/samples/visual-workflow-tracking