共用方式為


SharePoint - Extract WSP file from Configuration Database

Many a times we come across situation where we are building a Development \ Test environment replicating the Production Server, however we don’t have the solution which were deployed on production.

Hopefully information below may help a few of us.

In SharePoint 2010 :

To Extract the Solution from SharePoint Configuration database, run SharePoint management Shell as Administrator

$farm = Get-SPFarm

$wsp = $farm.Solutions.Item("Solution.wsp").SolutionFile

$wsp.SaveAs("c:\SP2010.wsp")

Add Solution

Add-SPSolution -LiteralPath <SolutionPath>

Deploy Solution

Install-SPSolution -Identity <SolutionName> -WebApplication <URLname>

Ref: https://technet.microsoft.com/en-us/library/cc262995.aspx

In SharePoint 2007:

PowerShell on MOSS 2007

Install : https://support.microsoft.com/kb/968930 (No Restart Required)

To Extract the Solution from SharePoint Configuration database, run Windows PowerShell as Administrator

Set-ExecutionPolicy UnRestricted

Press Y

Before programming against the SharePoint and/or MOSS 2007 object model the appropriate assemblies must be loaded. The following commands do this:

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)

$farm = [microsoft.sharepoint.administration.spfarm]::Local

$wsp = $farm.Solutions.Item("ApplicationTemplateCore.wsp").SolutionFile

$wsp.SaveAs("c:\SP2007.wsp")

Install Solution

stsadm.exe -o addsolution -filename <Solution filename>

Ref: https://technet.microsoft.com/en-us/library/cc263162(v=office.12).aspx

Deploy Solution

stsadm.exe -o deploysolution -name <Solution name>

Ref: https://technet.microsoft.com/en-us/library/cc262459(v=office.12).aspx

Comments

  • Anonymous
    January 01, 2003
    Good One.

  • Anonymous
    January 01, 2003
    Very good one. Tested in my lab and works great!! Thnaks for this ...

  • Anonymous
    July 27, 2015
    m/