I am a sharepoint devloper,but there are times when I have to jump into deployment activity and obviously I have to struggle even to do simple things.So recently my requirement was to get a wsp from one server and deploy it to another server.Sounds very simple but It wasn't for me unless I found the right way to do it.So thanks to powershell which helped me with it.Here is what I did
So all you you need to do is open the Powershell and run the following command in order to get the WSP file.
$myFarm = Get-SPFarm
$myWSP = $myFarm.Solutions.Item(“mywsp.wsp”).SolutionFile
$myWSP.SaveAs(“C:\wspFolder\mywsp.wsp”)
This simple piece of command will get you the WSP File.and if you don't want to use powershell and love writing code then write following pience of code on a button click or execute it the way you want it to work.
void getWSP_Click(object sender, EventArgs e)
{
SPSolutionCollection allSolutions = SPFarm.Local.Solutions;
foreach (SPSolution solution in allSolutions)
{
SPPersistedFile wsp= solution.SolutionFile;
if (wsp.Name == "mywsp.wsp")
{
wsp.SaveAs("c:\\wspFolder\\" + solution.Name);
}
}
}
Thanks for Reading and Hope this works for you.
So all you you need to do is open the Powershell and run the following command in order to get the WSP file.
$myFarm = Get-SPFarm
$myWSP = $myFarm.Solutions.Item(“mywsp.wsp”).SolutionFile
$myWSP.SaveAs(“C:\wspFolder\mywsp.wsp”)
This simple piece of command will get you the WSP File.and if you don't want to use powershell and love writing code then write following pience of code on a button click or execute it the way you want it to work.
void getWSP_Click(object sender, EventArgs e)
{
SPSolutionCollection allSolutions = SPFarm.Local.Solutions;
foreach (SPSolution solution in allSolutions)
{
SPPersistedFile wsp= solution.SolutionFile;
if (wsp.Name == "mywsp.wsp")
{
wsp.SaveAs("c:\\wspFolder\\" + solution.Name);
}
}
}
Thanks for Reading and Hope this works for you.