Getting solution files from SharePoint
Anyone who has ever done any sort of custom development for SharePoint knows about .wsp files. If you don’t know, .wsp files are packaged (IE zipped) collections of files that are deployed to a SharePoint farm. This includes dlls, features, custom controls – just about anything done in a custom development situation for SharePoint gets packaged into a .wsp file for deployment purposes. You can view the .wsp files deployed to any SharePoint farm via central administration.
Chances are also good that anyone who has ever done any sort of custom development for SharePoint also has run into situations where they need access to these .wsp files. The most common situation would be where the frontend is switching to another server and all these custom solutions need to be re-deployed to the new server. If you have access to the codebase that generated any of the custom solutions, that’s great; just get the .wsp from the code and you’re golden! But what of situations where you may not have access to the code that generated the .wsp file? What of a case where the person(s) responsible for the web frontend don’t actually have the .wsp anymore? What’s a developer to do?
There’s no way through the Central Administration UI to download a .wsp file, but luckily enough there is a really simple way to do this through powershell using only 2 lines:
$solution = Get-SPSolution SolutionName.wsp $solution.SolutionFile.SaveAs("C:\SolutionName.wsp")
Of course this assumes powershell is opened with the requisite SharePoint assembly loaded. If using just basic powershell, you’ll need to load the SharePoint assembly:
That’s it! Never again will you need to scramble and dig for a .wsp deployed to any farm.