本文介绍了Azure的Web应用程序:删除所有文件之前发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用下面的PowerShell脚本发布到我们的Azure的Web应用程序,我们经常有问题,从而从previous文件发布引起运行时错误。
When publishing to our Azure Web App using the following Powershell script, we often have issues whereby files from the previous publish cause runtime errors.
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
我怎么能前删除所有现有文件的发布?
注意,因为这需要标准的情况下,这是对我们的CI环境太贵了,我们不能使用的插槽。
Note that we cannot use slots because this requires Standard instances, which are too expensive for our CI environment.
推荐答案
尝试加入:
'SkipExtraFilesOnServer'=$false;
你的 $ publishProperties
应禁用DoNotDeleteRule MSDeploy用来保持周围多余的文件。
to your $publishProperties
that should disable the DoNotDeleteRule MSDeploy uses to keep extra files around.
这篇关于Azure的Web应用程序:删除所有文件之前发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!