I have some webparts. All of them has a property to enter the Site URL i.e the URL where the deployment should happen. My server farm contains, multiple zones with different URLs. In order to deploy each webpart I should change the Site URL for each zone before I actually build the application. Could you please let me know an easy way where I can deploy the application once for all the different URLs of webparts?
The same Site URL is taken as webapp URL when deploying the application using Powershell.
function DeployWsp([string]$solutionName, [string[]]$webApplicationList, [bool]$redeploy = $true) {
$solution = Get-SPSolution $solutionName -ea SilentlyContinue
# Remove the existing solution if it already exists
if($solution -ne $null -and $redeploy -eq $true)
{
Write-Host "Solution $solutionName already exists... Removing." -nonewline
if ($solution.ContainsWebApplicationResource) {
$solution | Uninstall-SPSolution -AllWebApplications -Confirm:$false
} else {
$solution | Uninstall-SPSolution -Confirm:$false
}
while ( $solution.JobExists ){
write-host "." -nonewline
sleep 2
}
Remove-SPSolution -Identity $solutionName -Confirm:$false
while ( $solution.JobExists ){
write-host "." -nonewline
sleep 2
}
Write-Host " Done."
}
if ($solution -eq $null -or !$solution.Deployed )
{
Write-Host "Deploying the $solutionName solution" -nonewline
$solution = Add-SPSolution "$pwd\$solutionName"
for ($i=0; $i -lt $webApplicationList.length; $i++)
{
$webApplication = $webApplicationList[$i]
if ($solution.ContainsWebApplicationResource) {
Write-Host " to $webApplication." -nonewline
Install-SPSolution $solutionName -WebApplication $webApplication -GACDeployment:$($solution.ContainsGlobalAssembly) -CASPolicies:$($solution.ContainsCasPolicy) -force
} else {
Install-SPSolution $solutionName -GACDeployment:$($solution.ContainsGlobalAssembly) -CASPolicies:$($solution.ContainsCasPolicy) -force
}
do {
Start-Sleep 5
Write-Host "." -nonewline
} while ($solution.JobExists)
Write-Host " Done."
}
}
}