Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
CreateWorkflow - throws exception "The input workflow type must be an Activity"

Odpovědět CreateWorkflow - throws exception "The input workflow type must be an Activity"

  • 13. dubna 2012 17:07
     
     

    My code is taken from the VS 2010 help file for Workflow class:

    Typetype = typeof(ImportXml);

    WorkflowInstanceworkflowInstance = WfRuntime.CreateWorkflow(type);

    Where ImportXml is my Workflow - it is actually a Flowchart.

    The exception "The input workflow type must be an Activity" is thrown.  The base type of ImportXml is System.Activities.Activity so I don't understand this.

Všechny reakce

  • 16. dubna 2012 7:24
    Moderátor
     
     Odpovědět

    Hi,

    We use WorkflowRuntime in Workflow 3(WF3) to host workflow and workflow service. However, Flowchart is not available in WF3, it is available in Workflow 4(WF4). Please make sure the target framework of your project is .NET Framework 4 or later version, then you can host your workflow by using WorkflowInvoker or WorkflowApplication. For example:

    WorkflowApplication wfApp = new WorkflowApplication(new ImportXml());

    wfApp.Run();

    For more information about hosting workflows in WF4, you can refer to:

    Hosting Workflows

    http://msdn.microsoft.com/en-us/library/dd489446.aspx

    If you still want to use WF3, then you need to use StateMachine workflow instead of FlowChart. Thanks.


    Leo Tang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.