Building a SharePoint 2007 workflow using WSPBuilder and Visual Studio 2008. Love, love, love the WSPBuilder tool, but the workflow templates could use some work. Ran into this one today…
I was receiving “Failed on Start (retrying)” errors. SharePoint logs showed “The workflow failed validation” exceptions. This usually means a problem with the .rules files associated with a Declarative Rule Condition.
I changed my While activities to use code conditions instead, and the problem went away. But I really wanted to find the source of the issue. After much trial and error and fruitless searches on the web, I finally found it. Turns out, it was a missing import target declaration in the .csproj file created by WSPBuilder when I created a workflow project using the “WSPBuilder Workflow with Workflow” project template.
To fix the problem, opened up the project file and added the missing import target line (in green), below. Evidently, this line tells studio to include the .rules in the assembly.
<Import Project=”$(MSBuildBinPath)\Microsoft.CSharp.targets” />
<Import Project=”$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets” />
Reopened the project, recompile, build wsp, redeploy. Bingo! Now my workflow works with Declarative Rule Conditions, as it should!
Thanks to Greg G’s post here that pointed me in the right direction.