You can create a small console application and access solutions using the SPFarm.Local.Solutions property. Enable the Microsoft.SharePoint.Administration namespace and use the following code snippet to download the solution file:
SPSolutionCollection solutions = SPFarm.Local.Solutions;
foreach (SPSolution solution in solutions)
{
SPPersistedFile wspFile = solution.SolutionFile;
wspFile.SaveAs("c:\\Temp\\Solutions\\" + solution.Name);
}
You need to make sure your output directory exists before calling SaveAs (). If it does not exist, an exception is thrown.
source
share