locked
Publishing a workflow with visual studio made custom activiy in the SharePoint desginer causes an error RRS feed

  • Question

  • To whom it may concern,

    I have developed a custom activity using Windows Workflow in Visual Studio as below:

    <WorkflowInfo>

      <Actions Sequential="then" Parallel="and">

        <Action Name="Image Processing Activities"

                ClassName="ImageProcessing.ImageReaderActivity"

                Assembly="ImageProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65e2374a40189510"

                AppliesTo="all" Category="Cross Site Actions">

          <RuleDesigner Sentence="Custom medical activities with parameter FirstName = %1 and parameter LastName = %2 (Output: %3)">

            <FieldBind Field="FirstName" DesignerType="TextArea" Id="1" />

            <FieldBind Field="LastName" DesignerType="TextArea" Id="2" />

            <FieldBind Field="FullName" DesignerType="ParameterNames" Id="3"/>

          </RuleDesigner>

          <Parameters>

            <Parameter Name="FirstName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="LastName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="FullName" Type="System.String, mscorlib"  Direction="Out" />

          </Parameters>

        </Action>

      </Actions>

    </WorkflowInfo>

     

     

    Basically the workflow is very simple, it passes two parameters first and last name into the custom activity ImageReaderActivity, and accepts the FullName from ImageReaderActivity as the output parameter.

     

    After setting up .actions file, deploy ImageProcessing.dll to the GAC, as well as sorting out authorized type in web.config file:

     

          <authorizedType Assembly="ImageProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65e2374a40189510"   Namespace="ImageProcessing" TypeName="*" Authorized="True" />

     

    Then restart IIS, fire up the SharePoint designer, I can see this custom activity in the Actions tab. All good. However, when I use this Activity in the workflow, set up the first name and last name and assign the full name to a workflow variable, save the workflow and then publish, it throws the following error:

     

    Errors were found when compiling the workflow. The workflow files were saved but cannot be run. 

     

    Error Details:

                                                                                                 (147, 22) Invalid token ';' in class, struct, or interface member declaration)

    If I remove output parameter (FullName), it will work fine after redeploying. Earlier, I managed once to make it work by restarting IIS, delete files at C:\Users\wfeng\AppData\Local\Microsoft\WebsiteCache and etc. However, after I do some changes and try to publish again, it never succeeds.

     

    Could someone have a look at this blocking issue?

     

    Cheers

     

    William Feng

     

     

     

    Wednesday, June 29, 2011 10:46 AM

Answers

  • Fixed it after 10 hours trying:


    <WorkflowInfo>

      <Actions  Sequential=" then"   Parallel=" and" >

        <Action  Name=" Image Processing Activities"

                ClassName=" ImageProcessing.ImageReaderActivity"

                Assembly=" ImageProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65e2374a40189510"

                AppliesTo=" all"   Category=" Cross Site Actions" >

          <RuleDesigner  Sentence=" Custom medical activities with parameter FirstName = %1 and parameter LastName = %2 (Output: %3)" >

            <FieldBind  Field=" FirstName"   DesignerType=" TextArea"   Id="1" />

            <FieldBind Field="LastName" DesignerType="TextArea" Id="2" />

            <FieldBind Field="FullName" DesignerType="ParameterNames" Id="3" Text="Output result #1" />

    <FieldBind Field="AssignedTo" DesignerType="ParameterNames" Id="3" Text="Output result #1" />

          </RuleDesigner>

          <Parameters>

            <Parameter Name="FirstName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="LastName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="FullName" Type="System.String, mscorlib"  Direction="Out" />

          </Parameters>

        </Action>

      </Actions>

    </WorkflowInfo>

     

     

    You need to add the Text attribute in the FieldBind element to make the compiler happy.

     

    Cheers

     

    William

     

    • Marked as answer by Emir Liu Wednesday, July 6, 2011 2:05 AM
    Thursday, June 30, 2011 1:47 AM

All replies

  • Fixed it after 10 hours trying:


    <WorkflowInfo>

      <Actions  Sequential=" then"   Parallel=" and" >

        <Action  Name=" Image Processing Activities"

                ClassName=" ImageProcessing.ImageReaderActivity"

                Assembly=" ImageProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=65e2374a40189510"

                AppliesTo=" all"   Category=" Cross Site Actions" >

          <RuleDesigner  Sentence=" Custom medical activities with parameter FirstName = %1 and parameter LastName = %2 (Output: %3)" >

            <FieldBind  Field=" FirstName"   DesignerType=" TextArea"   Id="1" />

            <FieldBind Field="LastName" DesignerType="TextArea" Id="2" />

            <FieldBind Field="FullName" DesignerType="ParameterNames" Id="3" Text="Output result #1" />

    <FieldBind Field="AssignedTo" DesignerType="ParameterNames" Id="3" Text="Output result #1" />

          </RuleDesigner>

          <Parameters>

            <Parameter Name="FirstName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="LastName" Type="System.String, mscorlib" Direction="In" />

            <Parameter Name="FullName" Type="System.String, mscorlib"  Direction="Out" />

          </Parameters>

        </Action>

      </Actions>

    </WorkflowInfo>

     

     

    You need to add the Text attribute in the FieldBind element to make the compiler happy.

     

    Cheers

     

    William

     

    • Marked as answer by Emir Liu Wednesday, July 6, 2011 2:05 AM
    Thursday, June 30, 2011 1:47 AM
  • OMG dude, you saved my day, only wasted about 2 hours on this one.  What a pain in the neck!

    In my case, I found that with a single instance of my custom activity, there were no problems, was able to save, publish, and run the WF with no issues.

    However, as soon as we added another instance of the activity, we ran into this error. 

    Thanks for the post!

    Tuesday, May 8, 2012 8:24 PM