I’ve just used a CustomWorkflow solution from Codeplex as an example. Our Tentacle is running as a user with farm permissions.
This code below runs as the deployment script and I’ve added a powershell step that checks if the deployment succeeded.
$packagePath = $OctopusOriginalPackageDirectoryPath
if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell”) -eq $null)
{
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
}
$solution = Get-SPSolution -Identity customworkflowactivitiesproject.wsp -ErrorAction silentlycontinue
if ($solution -ne $null)
{
Write-Output “Solution already installed - removing solution”
$solution.DeployedWebApplications | % {
$webapp = $_.Name;
Write-Output "Removing solution from $webapp...";
$solution | Uninstall-SPSolution -webapplication $webapp -Confirm:$false;
while (($solution.DeployedWebApplications | Where-Object {$_.Name -eq $webapp}) -ne $null)
{
Write-Output "Waiting 5 seconds for solution $webapp to be uninstalled";
Start-Sleep -Seconds 5;
}
Start-Sleep -Seconds 5;
}
Write-Output "Removing solution from farm"
$solution | Remove-SPSolution -Force -Confirm:$false
}
Write-Output "Installing solution"
Add-SPSolution -LiteralPath "$packagePath\CustomWorkflowActivitiesProject.wsp"
Install-SPSolution -Identity CustomWorkflowActivitiesProject.wsp -AllWebApplications -GACDeployment -Force