Deploy a workflow as a WSP file (SharePoint Server 2010)

 

Applies to: SharePoint Foundation 2010, SharePoint Server 2010

When you create a workflow and save it as a workflow template (.wsp file), you can use the template to deploy the workflow on multiple sites and site collections.

Video: Deploy a workflow as a WSP file

To deploy a workflow as a .wsp file, complete the following steps:

  • Download the WSP file

  • Upload the WSP file to a site collection

  • Activate the workflow feature on a site

Download the WSP file

Use the following procedure to open the Site Assets document library on the top-level site of the site collection that the workflow template was saved to and then download the workflow template as a .wsp file to a local folder on the server that is running Microsoft SharePoint Server 2010 or a network share. The downloaded file can then be uploaded to the Solutions Gallery of any site collection.

To download the WSP file to a file location

  1. On the top-level site, in the Quick Launch, click All Site Content.

  2. On the All Site Content page, in the Document Libraries section, click Site Assets.

  3. Point to the name of the workflow that you want to edit and click the arrow that appears.

  4. Point to Send To, and then click Download a Copy.

  5. In the File Download dialog box, click Save.

  6. In the Save As box, type the location to save the file, and then click Save.

  7. In the Download Complete dialog box, click Close.

Upload the WSP file to a site collection

Use one of the following procedures to upload the .wsp file to the Solution Gallery of a site collection. This will make the workflow template available as a feature which you will then activate on the site collection. This makes the workflow available as a feature on all sites in the site collection. However, this does not activate the feature on any sites in the site collection.

In this section:

  • To upload the WSP file to a site collection using the user interface

  • To upload the WSP file to a site collection by using Windows PowerShell

To upload the WSP file to a site collection by using the user interface

  1. On the top-level site of the site collection, on the Site Actions menu, click Site Settings.

  2. On the Site Settings page, in the Galleries section, click Solutions.

  3. On the Solutions tab of the ribbon, in the New group, click Upload Solution.

  4. In the Upload Document dialog box, click Browse.

  5. In the Choose File to Upload dialog box, find the file share, click the WSP file, and then click Open.

  6. In the Upload Document dialog box, click OK.

    The Solution Gallery – Activate Solution dialog box appears.

  7. In the Solution Gallery – Activate Solution dialog box, click Activate.

    This makes the workflow available as a feature to all sites in this site collection. The name of the workflow now appears in the Solutions Gallery with Status set to Activated.

To upload the WSP file to a site collection by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin. You also need to be a member of the SharePoint_Shell_Access role on the content database. For more information, see Add-SPShellAdmin and Get-SPContentDatabase.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. At the Windows PowerShell command prompt, type the following command:

    Add-SPUserSolution -LiteralPath <LiteralPath> -Site <SiteURL>
    

    Where:

    • <LiteralPath> is the full path that includes the name, of the WSP file.

    • <SiteURL> is the URL of the site collection.

    The workflow is now deployed as a feature. However, before you can use the workflow, you must activate it for the site collection.

  6. At the Windows PowerShell command prompt, type the following command:

    Install-SPUserSolution -Identity <Solution> -Site <SiteURL>
    

    Where:

    • <Solution> is the name of the solution to activate.

    • <SiteURL> is the URL of the site collection.

For more information about the Add-SPUserSolution and Install-SPUserSolution cmdlets, see Install-SPUserSolution and Add-SPUserSolution.

Note

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

Activate the workflow feature on a site

Use one of the following procedures to activate the feature on any sites where you want to use the workflow.

In this section:

  • To activate the workflow feature on a site by using the user interface

  • To activate the feature on a site by using Windows PowerShell

To activate the workflow feature on a site by using the user interface

  1. Go to the site where you want to activate the feature and on the Site Actions menu, click Site Settings.

  2. On the Site Settings page, in the Site Actions section, click Manage site features.

    On the Features page for the site, you can see that the workflow template is available but not active.

  3. Click Activate.

    On the Features page, the workflow template Status now appears as Active.

To activate the feature on a site by using Windows PowerShell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin. You also need to be a member of the SharePoint_Shell_Access role on the content database. For more information, see Add-SPShellAdmin and Get-SPContentDatabase.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. At the Windows PowerShell command prompt, type the following command:

    Enable-SPFeature -Identity <Feature> -Url <URL>
    

    Where:

    • <Feature> is the name of the feature to activate.

      Note

      The feature name is not the same name that you gave the workflow. Instead, the feature name is typically the workflow name with "ListInstances" appended to it.
      If you are not sure of the name of the feature that you want to activate, you can do the following to verify the feature name. 1) Make a copy of the .wsp file and change the file name extension on the copied file to .cab. 2) In Windows Explorer, right-click the .cab file, and then click Open. 3) Select feature.xml. The feature name is listed in the Path column.

    • <URL> is the URL of the site.

For more information about the Enable-SPFeature cmdlet, see Enable-SPFeature.

Note

We recommend that you use Windows PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

See Also

Other Resources

Resource Center: Workflows in SharePoint Server 2010