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

Deploying Workflow as WSP File

0.00/5 (No votes)
18 Jul 2012CPOL2 min read 17.6K  

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 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 the WSP file.

References

License

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