Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint

Deploying Workflow as WSP File

5.00/5 (1 vote)
10 Jul 2012CPOL2 min read 24.6K  
Deploying a Workflow as a WSP file.

Introduction

In this article we can learn how to:

  • Create WSP using Visual Studio 2010
  • Deploy WSP to another SharePoint site
  • Export a Workflow as WSP

WSP Extension

A file with WSP extension represents SharePoint Solution Package. It is actually a CAB file. When we create a workflow and make a WSP file we can use the file to deploy the Workflow to multiple SharePoint sites.

Creating a WSP File inside Visual Studio

We have to use the Package command for the solution to create the WSP file.

Image 1

You can get the WSP file inside the bin\Debug folder of the solution.

Image 2

The WSP file is actually a cabinet file. You can try opening it with WinZip/WinRar as shown below to see the contents.

Image 3

Deploying WSP to SharePoint

Now we can deploy the WSP file to SharePoint. For this, do the following steps.

Open the SharePoint site and use Site Settings > View All Site Content > Site Assets.

Image 4

Click on the Add document link as highlighted above.

Image 5

In the appearing dialog box, select the WSP file we generated and click the OK button.

After this step we need to activate the solution from Site Settings > Galleries  > Solutions.

Deploying using stsadm

We can deploy the solution using the command line tool of SharePoint. You can open the SharePoint 2010 Management Shell console from the Start menu. Execute the following command once in the debug folder.

Stsadm –o addsolution –filename YourSolution.WSP

Image 6

Once done with the above command, open SharePoint Central Administration and from System Settings > Manage Farm Solutions > select the workflow and click on the Deploy Solution button as shown below.

Image 7

Now go back to the SharePoint site and use Site Actions > Site Settings > Site collection features to activate the workflow.

Image 8

Now use the Site Actions > Site Settings > Workflow settings page to add the workflow.

Image 9

The deployment is completed and the Workflow is activated. You can access the workflow from List > Site Workflows > WF2.

Image 10

Export a Workflow as WSP

Now we can try exporting a WSP file from an existing SharePoint site. The exported file can be used to deploy to another SharePoint server. For exporting, follow the steps below.

Open Site Assets from Site Actions > View All Site Content.

Image 11

Click on an existing Workflow, for example Contact Workflow in the above screen. The browser will prompt with the Save As dialog. Click the Save button to get the WSP file. This file can be used to deploy the solution to another SharePoint server.

Summary

In this article, we have experimented with deployment of Workflow using a WSP file.

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)