Guidelines for Importing Reusable Workflows
To import reusable workflows created in SharePoint Designer, use the Import Reusable Workflow project template in Visual Studio. This template imports a declarative workflow (XML-only) and converts it into a code workflow, which is a workflow that you can enhance with either Visual Basic or Visual C# code. For more information, see Walkthrough: Import a SharePoint Designer Reusable Workflow into Visual Studio.
However, the Import Reusable Workflow template can import only farm solutions. If you want to deploy your workflow as a sandboxed solution, then import it with the Import SharePoint Solution Package template. However, by doing this, cannot convert it to code workflow and will not be able to modify it as such.
Importing Reusable Workflows by Using the Import Reusable Workflow Template
If you import a reusable workflow by using the Import Reusable Workflow template, you can run or change the solution just like any other Visual Studio SharePoint solution, but you may have to manually fix some items.
Importing Task Forms
The Import Reusable Workflow project template imports all initiation and association forms, but imports only one task form because the code workflow schema only permits one task form. Any additional task forms from the original workflow solution are put into the Other Imported Files folder in Solution Explorer.
Importing Reusable Workflows by Using the Import SharePoint Solution Package Template
If you import a reusable workflow by using the Import SharePoint Solution Package template, you need to consider the following issues:
After importing the workflow, you can immediately deploy and run it in Visual Studio by pressing F5. However, if you change anything in the workflow in the imported solution, you may have to manually fix elements in the project before you can deploy and run the workflow.
Because the workflow is declarative, code cannot be added to it. To convert the workflow into a code workflow, you must import it into Visual Studio by using the Import Reusable Workflow template.
While you can edit the workflow designer (.xoml) file in Design view, it is recommended that you edit it in Source view, because the workflow designer displays false errors.
Debugging in the workflow does not work for declarative content. Breakpoints set in the Workflow Designer are not hit.
Importing Globally Reusable Workflow Solutions
Globally reusable workflows cannot be imported by using the Import Reusable Workflow template. To import a globally reusable workflow, you have to convert it into a non-globally reusable workflow or you have to use the Import SharePoint Solution Package template.
To convert the workflow, make a copy of the globally reusable workflow in SharePoint Designer (by right-clicking the workflow and selecting Save as Copy). Then import the new reusable workflow with the Import Reusable Workflow template in Visual Studio.
To import the globally reusable workflow as-is, use the Import SharePoint Solution Package template. Using this method, the workflow is not converted to a code workflow and remains a declarative workflow.
See Also
Tasks
Walkthrough: Import a SharePoint Designer Reusable Workflow into Visual Studio