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