April 03, 2012

How to deploy wsp file using Visual Studio 2010 for SharePoint 2010

In SharePoint 2010 it is easy to create a .wsp file using visual studio 2010, which was previously very difficult in MOSS 2007. To deploy any solution package in any local environment in Visual Studio 2010 simply right click on the project and deploy. But to deploy the same thing in the production server we will need to deploy through .wsp file.


Steps to generate the wsp file:
 Right click on the project/solution in Visual Studio 2010 then choose package. If you are building the project/solution in debug mode then you will get the .wsp file inside the Bin\Debug folder and if you are building the project in release mode then you will get the .wsp file inside the Bin\Release folder. This wsp file is needed to deploy in the production environment.

This is the best way to create the wsp file in visual studio 2010.

There are different ways you can deploy the .wsp file

Using browser:

Go to the Central Administration -> Site Actions ->Site Settings -> Galleries –>click on Solutions. After this the below page will open as shown in the figure.

Click on Upload solution and then browse to the wsp file as shown below in 

the figure.

Once you will click Ok then activation window will appear like below figure.


Then you can use the solution.

Using PowerShell:

To add a solution using PowerShell:
Open the SharePoint 2010 Management Shell. You can get to this by going to Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.

Add-SPSolution {path of wsp file}

To deploy the solution using power shell
Install-SPSolution –Identity {path of wsp file}.wsp –WebApplication http:// -GACDeployment

To update solution
Update-SPSolution –Identity {path of wsp file}.wsp –LiteralPath {local path of wsp file}wsp –GACDeployment

To uninstall solution
Uninstall-SPSolution –Identity {path of wsp file}.wsp –WebApplication http://

Remove solution
Remove-SPSolution –Identity {path of wsp file}.wsp

Using Stsadm:

Open (Dos prompt) then type cd c:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin"

Add the solution using the following command
stsadm -o addsolution -filename {path of wsp file}

Deploy the solution
stsadm -o deploysolution -name {path of wsp file} -url {URL}

Retract solution:
stsadm.exe -o retractsolution -name {path of wsp file}.wsp –URL

Delete Solution
stsadm.exe -o deletesolution -name {path of wsp file}.wsp

4 comments:

  1. Great post, you have pointed out some superb details, I will tell my friends that this is a very informative blog thanks.
    IT Company India

    ReplyDelete
  2. Thanks for ur Comment.Sure recommend this blog to ur friends.I ll post more informative concepts soon.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Blog is talk about .wsp in SharePoint development which is really hectic task in earlier versions of SharePoint platform. Thus really helps in a big way to SharePoint developers.

    ReplyDelete