0
我想在powershell中調用Msdeploy,它是teamcity構建任務的一部分。Powershell Msdeploy命令錯誤
我的劇本是這樣的下面
$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"
而我運行此我得到以下錯誤,錯誤堆棧如下
Error: A '-dest' argument must be specified with the 'sync' verb.
由於錯誤說我已經包括同步關鍵字。
我做錯了什麼,我該如何糾正它?
我試着用下面的方法解決
感謝Cheif7,管理部署包throuh蔚藍的PowerShell命令發佈,AzureWebSiteProject。 (避免MSDeploy) – Bumble
很高興幫助。 – chief7