While migrating a workflow from a SharePoint Designer Workflow (more on why I did this in another post), I encountered an issue whereby my workflow constantly fails on start. After some blog searching, I found a solution. It is by adding this to the .CSPROJ file via Notepad or NotePad ++, I recommend the latter.

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" /> <– add this line after the above line.

Doing the action above will enable the workflow to work properly. Workflows that use declarative conditions are particularly susceptible to this. The version of the workflow foundation should be the one that is installed on the server. My company's server has .NET 3.0 installed so amend accordingly, for instance in my case it will be as follows :

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />

Kudos the the guy who found this. Embarrassingly I actually have done this before some time back but I forgot about this  .

Original Links :