
Sometimes the easiest way to resolve a missing SharePoint Solution dependency is simply to install it again. Often the solution package (WSP) is available on your development or test environment, but how do you download it from there? For sandboxed solutions, you can just go to the ‘Solutions’ section in Site Settings, but what about farm solutions?!
As it turns out it is relatively simple, if we use PowerShell. A similar approach can be taken for both farm solutions and sandboxed ones, but the point of attack differs slightly.
For a farm solution, just do the following in PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$farm = Get-SPFarm
$solution = $farm.Solutions.Item("mySolution.wsp")
$solution.SolutionFile.SaveAs("c:\tmp\mySolution.wsp")
Code language: PowerShell (powershell)
For a sandboxed solution, the technique is the same but you need to go to the site collection or web where the solution was deployed instead:
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$site = Get-SPSite "http://myspserver/mytargetsitecollection"
$solution = $site.Solutions.Item("mySolution.wsp")
$solution.SolutionFile.SaveAs("c:\tmp\mySolution.wsp")
Code language: PowerShell (powershell)
or…
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$web= Get-SPWeb "http://myspserver/mysitecollection/mytargetweb"
$solution = $web.Solutions.Item("mySolution.wsp")
$solution.SolutionFile.SaveAs("c:\tmp\mySolution.wsp")
Code language: PowerShell (powershell)