Home > sharepoint, Workflows, wspbuilder > Moving a sharepoint workflow between solutions – “Failed on Start (retrying)”

Moving a sharepoint workflow between solutions – “Failed on Start (retrying)”

The following blog is talking about an issue I had with moving a workflow. It does not talk about how to create workflows. If you want some really good information on that you can find some great tutorials by Robert Shelton here http://rshelton.com/archive/2007/10/05/sharepoint-document-workflow-with-visual-studio-workshop-documents-download.aspx. I really recommend going through his walk-throughs if you are learning how to build SharePoint workflows in Visual Studio 2008.

Today I attempted to take a workflow built with Visual Studio 2008 and move it to a WSPBuilder workflow. The reason I wanted to do this was because I had a nice Visual Studio solution for SharePoint already going utilizing WSPBuilder. Plus, the Visual Studio workflow solutions make it hard to deploy the association aspx pages easily without another web project.

Here are the details of the two solutions:
Solution 1 (original) – built with the Visual Studio 2008 SharePoint Sequential Workflow template
Solution 2 (new) – built with Visual Studio 2008 WSPBuilder.

So, to start I created a new sequential workflow in WSPBuilder and this built out my feature and initial workflow. Next, I created my aspx page in the layouts folder (this is the association page for my workflow). Next, I created the .cs page that will be the code behind for this aspx page. Now, this isn’t like a regular code behind because we aren’t in a web project and we are using SharePoint. This code behind will be in the GAC and the aspx page needs to reference it like this:

<%@ Page language=”C#” MasterPageFile=”~/_layouts/application.master”  
Inherits=”DocumentAssociationForm, DocumentApprovalWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5017f6ecf55b35e7″  %>

Notice my “Inherits” points to the assembly information and my MasterPageFile points to the application.master (because this page will live in the _layouts folder.

Now that I have my association pages built I needed to build out the workflow. I copied over the workflow I created in the original solution and placed it in the WorkflowCode folder (replacing the file that was put there by WSPBuilder when I created the workflow feature). Then I just made sure my feature.xml and elements.xml file were configured correctly to run this workflow. So, at this point I thought everything was ready to go. I used WSPBuilder to deploy my solution and I activated my feature on the site. I instantiated the workflow with my association data form I created and I was ready to test the workflow out. I went to run the workflow on an item in my list and I got this error: “Failed on Start (retrying)”. This made no sense to me because the same workflow worked fine from my original solution. So, was WSPBuilder causing the error? Did I mess up something? I really didn’t know. I then went to the SharePoint logs and found this error in them: “The workflow failed validation”.

Ah, my first clue. When a workflow fails validation, that usually means a .rules file is messed up. But, my .rules file seemed to be setup just fine. So, back to the drawing board.

After eliminating every possibility I went and took a look at the project files (.csproj) and I opened them up in notepad. I compared my new solutions file against my old solution and I noticed something. At the very end of the file on the original solution there was this line:

<Import Project=”$(MSBuildBinPath)\Microsoft.CSharp.targets” />
  <Import Project=”$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets” />

But, this was not in my new solution. So, it looks like the project file didn’t get notified to work with WF and version 3.5 specifically. I fixed the project file manually and everything worked.

Wow, that was a pain. But, in the end I have this workflow integrated into my larger solution so everything gets deployed at the same time. Thus, I don’t need a separate project just for my workflow and I don’t need a separate project just for my association form. It is really nice, but I almost put my head through the wall figuring it out.

Advertisements
  1. kelly
    June 19, 2008 at 7:27 pm

    THANKS. You are a life-saver, AGAIN. I have spent much of the last two days tearing files apart to see what I did wrong (differently). It seemed to work when I did not have an if/else and only had an activated and a code block. Once I put the if/else it “failed”. It seems like I was doing something wrong since it would work part of the time.

  2. July 16, 2008 at 1:11 am

    There may be more to it than that – I have a state machine workflow that is working without that import.

    I did need to change the targeted framework from 2.0 to 3.0 to get the designer to show up properly though, this was fairly obvious when building a workflow from scratch (no designer and errors on the workflow assembly references), but may be easy to miss if you are just copying and rebuilding.

  3. Greg Galipeau
    July 16, 2008 at 12:53 pm

    Thanks for the comment Tom. This blog was suppose to be just something for people to look for when moving workflows around. I never thought it would be something every workflow needed.
    My situation was actually because of the fact I was moving a .net 3.5 workflow around. That is why I needed those imports. I have seen other blogs that refer specifically to .net 3.0, so I wanted to put something out there to help people on the 3.5 framework.
    Anyways, this is more of a bug fix blog than a “how to” blog. Guess I should have been more clear. Thanks for you comment. Greg.

  4. Zohaib
    August 11, 2008 at 9:37 am

    I also have the same problem but my .csproj file is fine i am using only feature.xml, workflow.xml and workflow assembly to deploy to another system but encountering the same “Failed on Start (retrying)” problem. can any one help me urgent…

  5. Stuart
    April 7, 2009 at 6:13 am

    Thank you Greg! I was pulling my hair out over this one, and your post cleared it up nicely. My problem was the missing target in the .csproj file, just like you suggested.

    See my related post, http://techpunch.wordpress.com/2009/04/07/sharepoint-wspbuilder-workflow-failed-on-start/

  6. Gowtham
    July 13, 2009 at 6:09 pm

    I’m having the same error and my .csproj file has the two lines that you mentioned above at the end of the file. Is there any other way to get rid of this error?

  7. November 9, 2009 at 9:30 pm

    Nice Post and good information.

    It didn’t resolve my problem somehow.

    I am getting same error while starting of workflow, FYI: I am not using WSPBuilder, I created workflow using VS 2008 (SharePoint 2007 Sequential workflow template), when I put “While” activity OR “If” activity with “declaration code”, it’s giving me above error.

    I already checked into my project file, I have below highlighted line as per your post.

    It seems that some DLL got corrupt or something else or I am missing some code 😦

    If you have any idea related to this, can you please help me to resolve this error?

    Thank you!
    Sanket

  1. May 23, 2008 at 1:20 am
  2. April 7, 2009 at 5:57 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: