There are a couple of blogs out there about exporting reusable workflows but none of them really cover the problems that I ran into recently.
First of all the important question is why doing this in the first place? SharePoint Designer (SPD) is the tool that you started with to create your workflow … Did you make the wrong decision during the beginning of your project and now you changed your mind? Maybe you should just start all over again from scratch …
In my case, I want my customer to be able to update the workflow at any time but they shouldn’t need to use Visual Studio. (Reason to use SPD)
Also, SPD left some bits in the wsp which I already deleted ( e.g. I created a task which I later decided wasn’t required. the .xsn file for this task and the content type is still there in my .wsp)
When you try to deploy a .xoml file which is created by SPD you need a converted version of this file in your VS2010 project (using the import function). This then might make SPD not happy when you try to edit it at a later stage in SPD.
Finally I wanted to get more control over my declarative workflow. In my workflow I had multiple approval steps. this resulted in two content types Approval and Approval(1), or even worse Approval_x0028_1_x0029_. Next to this every file seems to need a number in SPD. In Viaul Studio you can clean this up.
Moving the SharePoint Designer workflow to Visual Studio
Most importantly after converting the workflow I was still able to get SPD to update the workflow.
How did I do this? Here are the rough steps:
- Export your workflow from SPD to a wsp file.
Extract all files from the .wsp (you could use winrar)
Create a new wspbuilder project ( see codeplex)
Copy all the files from the .wsp into your project
Now you can build and deploy the workflow using wsp builder.
If your not very keen on using wspbuilder then you could follow my example where I have multiple projects, of which one is my SPD workflow project using wspbuilder, and all the other ones are using VS 2010 standard builder.