I am doing some custom SharePoint 2007 Workflow development utilizing WSPBuilder and I had this one workflow that just would not run no matter what I did. I disabled all the activities in it except a Workflow History logging activity but still the workflow would not start. I am a little embarrassed to say this was driving me insane for the better part of a day.
No matter what I did when I ran the workflow I would get
I searched through the SharePoint logs over and over again and all I was seeing was unable to load workflow assembly, but I knew it would load since I had other workflows in this library and they all ran no problem.
Here is the error message out of the log file, I hope you spot the problem:
Load Workflow Assembly: System.IO.FileLoadException: Could not load file or assembly 'com.XXXX.Sharepoint.Workflows\, Version\=22.214.171.124\, Culture\=neutral\, PublicKeyToken\=$PublicKeyToken$' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) File name: 'com.XXXX.Sharepoint.Workflows\, Version\=126.96.36.199\, Culture\=neutral\, PublicKeyToken\=$PublicKeyToken$' at System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at ...
Well that part I was not seeing was PublicKeyToken\=$PublicKeyToken.
It turns out that when I created the feature using the WSPBuilder create SyncSharePointWorkflow option it must have had an error I did not notice and this error caused it not to add the PublicKeyToken to the elements.xml file. Or maybe it never did and I just forgot to update this line.
CodeBesideAssembly="com.XXXX.Sharepoint.Workflows, Version=188.8.131.52, Culture=neutral, PublicKeyToken=$PublicKeyToken$"
Anyway once I added the correct Public Key, retracted and redeployed the workflow, it ran fine.
Hope this helps someone else save a day!!!