Visual Studio 2008 custom workflows not starting - TIPS
I was doing some SharePoint Workflow development the other day in Visual Studio 2008 and I had the situation where my workflows wouldn't start after they have been deployed.
I found that if the following aren't configured correctly, none of your workflows will start and throw unexpected errors.
Here are some things to check to ensure that your custom workflows will start as expected:
1) Ensure that the workflow.xml references the right ‘PublicKeyToken’ value of the underlying workflow assembly.
To get this value, build and deploy your workflow and get the public key value from the GAC, replace this value in your workflow.xml.
The assembly in the GAC should match the value in the workflow.xml otherwise you will get a workflow assembly not found error when trying to execute.
2) Don't change the onWorkflowActivated1 correlation token. Leave it set to the default. If you changed it, change it back. (Don't be tempted like I was)
3) Ensure that each new task has its own correlation token. I tried sharing these (I was trying to be clever) but it doesn't work.
The rule is each new task and related actions, use a new correlation token.
4) Ensure the namespaces for the Visual Studio project matches what is in the workflow1.cs and workflow1.designer.cs files.
If you change namespaces for the Visual Studio project also change the namespaces in the workflow1.cs and the workflow1.designer.cs files as well.
If you change the namespace in the project, it will still compile, but the workflow wont run. Change in all three places.
5) Remember to deploy any external libraries that your workflow depends to the GAC as part of your build process in Visual Studio. Otherwise your workflow will fail as it cannot find the external dependency.
The command to set a post build event is as follows:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\"gacutil /i "$(TargetPath)" /f
Hopefully these tips will save you a lot of time!