October 5, 2010

Developing Custom SharePoint 2007 Workflows in a 64-bit Development Environment

I got a new requirement last week to build a state machine workflow for my client, and having the experience in building workflow, I went ahead and put in the time estimate needed to complete this task.

So I went into VS2010, File –> New –> Project, Under Installed Templates, drill down to Visual C# –> SharePoint –> 2007 and select SharePoint 2007 State Machine Workflow,  type in a name for your project and hit OK. and BOOM! I get an error!!!

Issue

image

Error message: A 32-bit version of Windows SharePoint Services is required by this project but is not installed on the system. Please install Windows SharePoint Services 3.0, available either from the Microsoft Download Center or as part of Microsoft Office SharePoint Server 2007.

Solution

After researching this issue, I realized it is not possible to build workflows using the VS template to build workflows on a 64bit machine, what a bummer right!

Some sites recommended using WSPBuilder’s workflow template to create a state machine workflow that would work on a 64bit machine, so I went back, deleted the broken solution folder that just got created and started fresh in VS2010.

So I went into VS2010, File –> New –> Project, Under Installed Templates, drill down to Visual C# –> WSPBuilder and select WSPBuilder Project with Workflow,  type in a name for your project and hit OK.

This created the shell for developing my workflow, didn’t seem to blow up which is a good sign so far.

Next step was to add the actual workflow feature that will deploy my workflow to my environment.

So I went to Project–> Add New Item, Under Installed Templates, drill down to Visual C# –> WSPBuilder and select State Machine Workflow,  type in a name and hit OK. Next its going to show you the feature wizard, set it up as you please and hit OK.

After that step, your solution explorer should look similar to this:

image

Now, if you open the workflow designer by double clicking on the StateWorkflowFeature1.cs, you should see the workflow designer that allows you to create your actual workflow. DONE? not so fast!!! if you look at your toolbox, you will notice that SharePoint Workflow Actions are missing! and what good will that do me if I cannot get those to work with…

Issue

SharePoint Workflow Toolbox Tab is missing and cannot get it to show up in my project

Solution

Looking at my <Projectname>.csproj file in notepad made me realize that my project has the following ProjectTypeGuids:

<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

After looking at this blog post, I found out that they represent the following project types:

  • Workflow (C#) {14822709-B5A1-4724-98CA-57A101D1B079}
  • Windows (C#) {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

Hmm, where is the SharePoint workflow reference?! so I picked the SharePoint Workflow reference and added it to the ProjectTypesGUIDS so that they look like the following:

<ProjectTypeGuids>{F8810EC1-6754-47FC-A15F-DFABD2E3FA90};{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Reloaded my project and viola! my Workflow designer is now showing the SharePoint Workflow toolbox items.

3 comments:

  1. Excellent Post, Dennis. I followed this to the letter and it worked perfectly. Although my default .NET framework was set to 2.0 I had to change that and all the references loaded great. I should also note that I was able to get this working with VS 2008 (obviously in a 64 bit SharePoint 2007 environment). I'll let you know if I have any issues in 2008.

    ReplyDelete
  2. I also have VS2010 and MOSS2007 on a 64-bit windows server 2003 with SP2. I followed all your steps succesfully. But when I changed the project properties, for instance the Target List and hit the ... button, I got the 32-bit version of Windows Sharepoint Services is required error back.

    ReplyDelete
  3. So far so good; in addition to the above steps I had to add an assembly reference to System.Workflow.Activities after adding a Sequential workflow to the project.

    ReplyDelete