Tuesday, August 14, 2012

Adding and Deploying SharePoint 2010 .WSP Solutions

Every SharePoint specialist is doing this process when deploy SP solution package on production server, so I write this article to keep it as a reference for me and share it with others to help and get feedback/ides for best practices.
In my Scenario, I have 2 WSP files:
  • NewSolutionPack.wsp (to add it as first time)
  • UpdateSolutionPack.wsp (to update an exist WSP file)
  • Target web application (http://sps:1)
clip_image001[7]

The steps of deployment are easy:

1. Add solution to Farm Solutions
2. Deploy your solution to a specific web application or to all web applications
3. In case of exists solution, you will upgrade the solution using one of the following options:
a. Retract and delete the old solution, then add and deploy the new one
b. Or, upgrade the existing solution using upgrade method (recommended).

Steps of deployment using STSADM
1. Add solution to Farm Solutions
a. Open cmd (Star > Run > write cmd in box > click ok)
clip_image002[7]
b. Mont the folder that contain stsadm execution file (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN)
clip_image004[7]
clip_image006[7]
c. Enter the following script
stsadm -o addsolution -filename “C:\WSP Deployment\NewSolutionPack.wsp”
clip_image008[7]
2. Deploy your solution
a. To a specific web application
stsadm -o deploysolution -name “NewSolutionPack.wsp” -url “http://sps:1″ -allowgacdeployment -immediate –allowcaspolicies
clip_image010[7]

Check it from Central Administration > System Settings > Manage Farm Solutions

clip_image012[7]
b. To all web applications
stsadm -o deploysolution -name “NewSolutionPack.wsp” -allcontenturls -allowgacdeployment -immediate –allowcaspolicies

clip_image014[7]
3. Upgrade the solution by Retract and delete the old solution, then add and deploy the new one
a. stsadm -o retractsolution -name “NewSolutionPack.wsp” -url “http://sps:1″ –immediate
if you want to retract the solution from all web applications, you need to use this
stsadm -o retractsolution -name “NewSolutionPack.wsp” -allcontenturls –immediate
b. stsadm -o deletesolution -name “NewSolutionPack.wsp”
c. stsadm -o addsolution -filename “C:\WSP Deployment\NewSolutionPack.wsp”
d. stsadm -o deploysolution -name “NewSolutionPack.wsp” -allcontenturls -allowgacdeployment -immediate –allowcaspolicies
4. Upgrade the solution by using upgrade method
a. Enter upgrade script
stsadm -o upgradesolution -name “NewSolutionPack.wsp” -filename “C:\WSP Deployment\UpdateSolutionPack.wsp” -allowgacdeployment -immediate –allowcaspolicies
clip_image016[7]

Steps of deployment using PowerShell
1. Add solution to Farm Solutions
a. Open PowerShell (SharePoint 2010 Management Shell)
clip_image018[7]
b. Enter the following script:
Add-SPSolution “C:\WSP Deployment\NewSolutionPack.wsp”
clip_image020[7]
2. Deploy your solution
a. To a specific web application
Install-SPSolution -Identity “NewSolutionPack.wsp” -WebApplication “http://sps:1″ -GACDeployment -CASPolicies -Confirm:$false
b. To all web applications
Install-SPSolution -Identity “NewSolutionPack.wsp” -AllWebApplications -GACDeployment -CASPolicies -Confirm:$false
3. Upgrade the solution by Retract and delete the old solution, then add and deploy the new one
a. Uninstall-SPSolution -Identity “NewSolutionPack.wsp” -WebApplication “http://sps:1″ -Confirm:$false
if you want to retract the solution from all web applications, you need to use this
Uninstall-SPSolution -Identity “NewSolutionPack.wsp” -AllWebApplications -Confirm:$false
b. Remove-SPSolution -Identity “NewSolutionPack.wsp” -Confirm:$false
c. Add-SPSolution “C:\WSP Deployment\NewSolutionPack.wsp”
d. Install-SPSolution -Identity “NewSolutionPack.wsp” -WebApplication “http://sps:1″ -GACDeployment -CASPolicies -Confirm:$false
4. Upgrade the solution by using upgrade method:
Update-SPSolution -Identity “NewSolutionPack.wsp” -LiteralPath “C:\WSP Deployment\NewSolutionPack.wsp” -GacDeployment -CASPolicies -Confirm:$false
For more information about mapping from stsadm to PowerShell, read the full MSDN topic: Stsadm to Windows PowerShell mapping (SharePoint Foundation 2010)
I Hope this useful for you,
Thanks.

No comments:

Post a Comment