【发布时间】:2016-06-13 22:40:19
【问题描述】:
我正在尝试在 powershell 中调用 Msdeploy,这是 teamcity 构建任务的一部分。
我的脚本如下所示
$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.
正如错误所说,我已经包含了同步关键字。
我做错了什么,我该如何纠正它?
我尝试使用以下解决方案
【问题讨论】:
标签: powershell deployment teamcity msdeploy