Is there a way to back up/restore SharePoint 2010 Application Pages built with Visual Studio?
-
16-12-2020 - |
Pregunta
I have a few separate Application Pages built for SharePoint 2010 using Visual Studio 2012 and I'd like a way to back up and restore these SharePoint solutions (does not have to be a SharePoint based backup/restore) in case of server failure or other means.
Thanks.
Solución
First, to be able to create an Application Page
in SharePoint, you should create a SharePoint Solution then add an application page that must be deployed as farm solution only.
When you build your solution, it's packaged in a SharePoint Solution package (WSP) file. and you can use PowerShell Add-SPSolution
and Install-SPSolution
to deploy it to your farm.
After deploying your solution the Application page will be located in 14 hive at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\yoursolution name
And the WSP solution should be listed in Central administration > System Management > Manage Farm Solutions
So you need to backup and restore a WSP solution rather than page as the following:
Backup WSP solution,
Now you will be able to backup all the WSP solution that deployed to your farm via PowerShell as the following:
$FolderPath = "c:\WSPSolutions"
foreach ($solution in Get-SPSolution)
{
$id = $Solution.SolutionID
$title = $Solution.Name
$filename = $Solution.SolutionFile.Name
$solution.SolutionFile.SaveAs("$FolderPath\$filename")
}
Or you can just backup specific solution as
$file = (Get-SPFarm).Solutions.Item("AppPageSolution.wsp").SolutionFile
$file.SaveAs("c:\backup\AppPageSolution.wsp")
Restore WSP solution,
- you can perform bulk deploy using https://spsd.codeplex.com/
- Or use
Add-SPSolution
andInstall-SPSolution
.
For more details check Install and deploy a SharePoint (WSP) Solution Package using SharePoint Shell