Search code examples
visual-studio-2010sharepointsharepoint-2010sharepoint-designercustom-action

Sharepoint Designer says: "The list of workflow actions on the server references an assembly that does not exist"


I successfully deploy my custom Action to the list of Actions available for use in my SharePoint Designer, but when opening an existing workflow, or creating a new one in the Designer, I get the message (and of course my custom action is not on the list of actions)

The list of workflow actions on the server references an assembly that does not exist. Some actions will not be available. The assembly strong name is {Actual Assembly strong name}. Contact your server administrator for more information.

I checked the Strong Assembly name, Global Assembly Cache, package options, .ACTIONS file, web.config... Everything seems ok. Any new Ideas?


Solution

  • I am assuming the custom action is a farm deployed activity, which inherits from System.Workflow.ComponentModel.Activity (perhaps using subclass SequenceActivity, but really that doesn't matter)

    I'm guessing that you haven't created the required ACTIONS file, which gets deployed to TEMPLATE\1033\Workflow

    <?xml version="1.0" encoding="utf-8" ?>
    <WorkflowInfo>
      <Actions Sequential="then" Parallel="and">
        <Action Name="Description for SP Designer"
                Assembly="$SharePoint.Project.AssemblyFullName$"
                ClassName="AssemblyName.ClassName"
                AppliesTo="all"
                Category="SPD category"
                UsesCurrentItem="true"
                >
          <RuleDesigner Sentence="Line as it appears in SPD workflow" />
          <Parameters>
            <Parameter Name="__ActivationProperties" Type="Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties, Microsoft.SharePoint" Direction="In" />
          </Parameters>
        </Action>
      </Actions>
    </WorkflowInfo>
    

    SPD reads the list of activities from the ACTIONS files. Adding the file will get it into the menu. To actually add it to the workflow, you also need to authorize the custom workflow activity by class name.

    To add the authorized type, I use a feature receiver with the following spwebmodification:

    private SPWebConfigModification CreateWebConfigModification(string assembly, string assemblyNamespace)
    {
        return new SPWebConfigModification()
        {
            Type = (SPWebConfigModification.SPWebConfigModificationType)0,
            Name = String.Format("authorizedType[@Assembly='{0}'][@Namespace='{1}'][@TypeName='*'][@Authorized='True']", (object)assembly, (object)assemblyNamespace),
            Path = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes",
            Owner = assemblyNamespace,
            Sequence = 0U,
            Value = String.Format("<authorizedType Assembly='{0}' Namespace='{1}' TypeName='*' Authorized='True' />", (object)assembly, (object)assemblyNamespace)
        };
    }
    

    this will generate an SPWebConfigModification which can be used during install/uninstall.