Saturday, May 14, 2011

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

SharePoint Article  |  SharePoint Jobs  |  SharePoint Forum  |  Register For Updates
A solution package is a distribution package that delivers your custom SharePoint Server 2010 development work to the Web servers or the application servers in your server farm. Use solutions to package and deploy custom Features, site definitions, templates, layout pages, Web Parts, cascading style sheets, and assemblies.

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:

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

7 comments:

Abhi said...

Ya.. its really nice.. I like it.. Thanks

gmat1984 said...

Oh! I found one good blog after a long time.
Nice one.

Anonymous said...

What are the prerequisites for installing solutions? When I activated solution it is not listed into create new site window

Fewlines4Biju said...

Hi No prerequisites I will give one solution soon !!!

Anonymous said...

I get the activation window but the activate button is inactive. I'am Farm admin but I cannot activate the solution. Any suggestions?

Bijay Kumar said...

Nine times out of ten you will not be able to install the wsp from the browser. Go straight to the shell. Those tools are there as decoration only.

Bijay Kumar said...

Nice

Post a Comment