I am trying to invoke Msdeploy in powershell , which is part of a teamcity build task.
My script is like this below
$folderName = "packageTmp"
$packagePath = (gci -path %teamcity.build.checkoutDir%\extract -filter $foldername -Recurse | Select-Object -Expand FullName) |Out-String
$azureSite ="%azureSite%"
$azurePublishUrl = "%azurePublishUrl%"
$azureUsername ="%azureUsername%"
$azurePassword = "%azurePassword%"
$localPath =$packagePath
$server ="https://$azurePublishUrl/msdeploy.axd?site=$azureSite,UserName=$azureUsername,Password=$azurePassword,AuthType=Basic"
$remotePath="%azureSite%"
$env:Path += ";C:\Program Files\IIS\Microsoft Web Deploy V3"
function PushToTarget() {
param([string]$server, [string]$remotePath, [string]$localPath)
cmd.exe /C $("msdeploy.exe -verb:sync -source:contentPath=`"{0}`" -dest:computerName=`"{1}`",contentPath=`"{2}`" -whatif" -f $localPath, $server, $remotePath )
}
echo "Server: " $server
echo "remote path: " $remotePath
echo "local path: " $localPath
PushToTarget "$server" "$remotePath" "$localPath"
while i run this i get following error , error stack follows
Error: A '-dest' argument must be specified with the 'sync' verb.
As error says i have included sync keyword already.
what i am doing wrong and how can i rectify it ?
i tried to use following solutions