Dav*_*New 3 powershell azure msdeploy azure-web-sites azure-powershell
使用以下Powershell脚本发布到我们的Azure Web App时,我们经常遇到问题,即先前发布的文件会导致运行时错误.
param($websiteName, $packOutput)
$website = Get-AzureWebsite -Name $websiteName
# get the scm url to use with MSDeploy. By default this will be the second in the array
$msdeployurl = $website.EnabledHostNames[1]
$publishProperties = @{'WebPublishMethod'='MSDeploy';
'MSDeployServiceUrl'=$msdeployurl;
'DeployIisAppPath'=$website.Name;
'Username'=$website.PublishingUsername;
'Password'=$website.PublishingPassword}
Write-Output "Stopping web app..."
Stop-AzureWebsite -Name $websiteName
Write-Output "Publishing web app..."
$publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"
Write-Output "Starting web app..."
Start-AzureWebsite -Name $websiteName
. $publishScript -publishProperties $publishProperties -packOutput $packOutput
Run Code Online (Sandbox Code Playgroud)
如何在发布之前删除所有现有文件?
请注意,我们不能使用插槽,因为这需要标准实例,这对我们的CI环境而言过于昂贵.
尝试添加:
'SkipExtraFilesOnServer'=$false;
Run Code Online (Sandbox Code Playgroud)
你$publishProperties应该禁用DoNotDeleteRule MSDeploy使用暂时保留额外的文件.
| 归档时间: |
|
| 查看次数: |
1643 次 |
| 最近记录: |