Friday, 12 October 2012

Deploying WSP using Powershell


What is a Solution Package?

A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assemblies that apply to sites, and that you can enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, .dwp files, and other package components. A solution file has a .wsp file extension.
How to add the solution to the sharepoint farm and then deploy it to a particular web application is discussed below.

1. Adding solution package to the server

stsadm.exe -o addsolution -filename myEventCalendarList.wsp
OR
Use the complete location of the file, for example:
stsadm.exe -o addsolution -filename “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\Solution\myEventCalendarList.wsp”

Deploy solution package command

2. Deploying the Solution

Deploy the solution using the following command:
stsadm -o deploysolution -name myEventCalendarList.wsp  -url http://sp-dev/ -local  -force
Here( -url) means the web application where to deploy the solution.
OR
Goto, Central Administration > System Settings >Manage farm solutions
Now click your solution from the list (for example, myEventCalendarList.wsp).

Manage farm solutions
a)  Now click Deploy Solution and select the web application where you want to deploy the solution (example, http://sp-dev here), Click OK when you are done.

Click Deploy Solution

Select web application where you want to deploy
b)  And finally you will have your solution deployed status like the following.

solution deployment status
You are done with deployment.

OPTIONAL STEP (You can do it when necessary):

Now you have to enable this feature at the website to use it. To do it follow these steps:
3.  Enable the features at the website>>
Go to your Site settings> Site Collection Administration > Site collection features
And activate the feature (myEventCalendarList ,for example)  that you have installed. And add that webpart  to your site to test.
Hope it helps.

No comments:

Post a Comment