Tuesday, 11 February 2014

Nice WSP Deployment Script

Clear
# Configuration
$webApp = "http://hostname.local/"
# Functions
function X-WaitOnSolution($solution, $jobName)
{
Write-Host "> $jobName" -NoNewline
while ($solution.JobExists)
{
Write-Host "." -NoNewline
Start-Sleep -Seconds 1
}
Write-Host ""
}
function X-RedeployWsp($wspName, $webAppTarget)
{
Write-Host "$wspName"
$wsp = Get-SPSolution -Identity $wspName
if ($wsp -ne $null)
{
if ($webAppTarget)
{
Uninstall-SPSolution -Identity $wsp -AllWebApplications
}
else
{
Uninstall-SPSolution -Identity $wsp
}
X-WaitOnSolution -solution $wsp -jobName "Uninstall"
}
$wsp = Get-SPSolution -Identity $wspName
if ($wsp -ne $null)
{
Remove-SPSolution -Identity $wsp
X-WaitOnSolution -solution $wsp -jobName "Remove"
}
Add-SPSolution -LiteralPath "$path\$wspName" > $null
$wsp = Get-SPSolution -Identity $wspName
X-WaitOnSolution -solution $wsp -jobName "Add"
if ($webAppTarget)
{
Install-SPSolution -Identity $wspName -GACDeployment -WebApplication $webApp
}
else
{
Install-SPSolution -Identity $wspName -GACDeployment
}
$wsp = Get-SPSolution -Identity $wspName
X-WaitOnSolution -solution $wsp -jobName "Install"
}
# Preparation
$ConfirmPreference = "none"
$path = Split-Path $MyInvocation.MyCommand.Path
X-RedeployWsp -wspName "WebAppTargetedSolution.wsp" -webAppTarget $true
X-RedeployWsp -wspName "NonWebAppTargetedSolution.wsp" -webAppTarget $false
view raw gistfile1.ps1 hosted with ❤ by GitHub

Convert SharePoint 2010 solution > 2013

http://stackoverflow.com/questions/14716641/convert-sharepoint-2010-solution-to-2013-and-visual-studio-2012

http://sadomovalex.blogspot.ru/2013/02/convert-visual-studio-sharepoint-2010.html