I am using powershell to update and deploy solutions
UpdateSolution.ps1
Add-SPSolution -Identity SomeWP.wsp -LiteralPath $PSScriptRoot\SomeWP.wsp -GACDeployment
Add-SPSolution -Identity SomeWP.wsp -LiteralPath $PSScriptRoot\SomeWP.wsp -GACDeployment
Deploy Solution.ps1
param([string]$workspaceUrl)
[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges(
{
Install-SPSolution –Identity SomeWP.wsp –WebApplication $workspaceUrl –GACDeployment -Force
Install-SPSolution –Identity SomeWP.wsp –WebApplication $workspaceUrl –GACDeployment -Force
}
)
Now if I run Update.ps1 and wait for sometime and then run Deploy.ps1, it works fine, but if I run them one after the other it says
Install-SPSolution : A deployment or retraction is already under way for the solution "someWP.wsp", and only one deployment or retraction at a time is supported.
Now how can I automate this? like once the update is complete, I want to run deploy automatically
Install-SPSolution
on the same WSP you just updated? To my understanding, that is redundant.Update-SPSolution
will update a WSP "live", so to speak, and it will remain deployed (but now updated). You would only need to runInstall-SPSolution
if you had retracted and removed the WSP, which you bypassed by runningUpdate-SPSolution
in the first place.Add-SPSolution
then you need to runInstall-SPSolution
to deploy it. But once it's deployed,Update-SPSolution
is all you need.Install
afterUpdate
, butUpdate
causes a re-deployment of the solution, which is why you would get the error "A deployment...is already underway".Add
does not trigger a deployment (which is why you have to runInstall
after it), so you may not get the same error....