Exporting reusable workflows from SharePoint Designer 2010 to Visual Studio 2010

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.

Exporting workflows

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:

  1. Export your workflow from SPD to a wsp file.
  2. Extract all files from the .wsp (you could use winrar)
  3. Create a new wspbuilder project ( see codeplex)
  4. Copy all the files from the .wsp into your project
  5. 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.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. You can contact me using contact@sharepains.com

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading