UPDATE 2: I have now written a post describing how I got persistence working in WF4 beta 2.
UPDATE: Seems that they have changed just about everything concerning persistence from WF4 beta 1 to beta 2. So the forth part of the tutorial I’m referring to doesn’t seem to work at all for beta 2. I’ll have to do a follow-up on how it works once I’ve figured it out. /J
Since we are going to use Windows Workflow Foundation 4 in our new project, I though I’d better learn the basics of it. So I found Microsoft’s Getting Started Tutorial, and started following it. The first three parts went well, although I suddenly remembered how much I hate drag-and-drop-programming. But when I came to the fourth part (the most interesting one, I might add), How to Create and Run a Long Running Workflow, I ran in to a small problem.
The tutorial told me to add references to System.WorkflowServiceModel and System.WorkflowServices. Problem is, when I opened the Add References dialog, those assemblies do not exist!
“How can this be?”, you might cry. Well, it turns out that Microsoft in their infinite wisdom* have introcuded something called profiles in the target framework of the project. In .NET 4 there are two profiles: .NET Framework 4 and .NET Framework 4 Client Profile, the client profile being the default (in .NET 3.5 there is also a Server Core Profile). And the client profile does not include System.WorkflowServiceModel and System.WorkflowServices!
So, in the end the solution is simple, just change the target framework to the full .NET Framework 4, and everything will work fine. You could argue that they should have added this in the tutorial, though. :-)
On a completely unrelated note, I just heard that I have been nominated for IT consultant of the year at the 2009 IT Business Awards, and even made it to the final three. Not sure what to make of that…
* I don’t mean this as a mockery, I actually think it’s a good idea.