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


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.

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.

Using browser:

Go to the Central Administration -> Site Actions ->Site Settings -> Galleries –> click on Solutions.
Click on Upload solution and then browse to the wsp file from the ribbon.
Once you will click Ok then activation window will appear. Click on Activate.
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:

Add the solution
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

Comments