【问题标题】:Azure Web App: Delete all files before publishAzure Web App:发布前删除所有文件
【发布时间】:2015-12-13 21:55:33
【问题描述】:

当使用以下 Powershell 脚本发布到我们的 Azure Web 应用程序时,我们经常会遇到问题,即之前发布的文件会导致运行时错误。

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 环境来说太昂贵了。

【问题讨论】:

    标签: powershell azure azure-web-app-service msdeploy azure-powershell


    【解决方案1】:

    尝试添加:

    'SkipExtraFilesOnServer'=$false;
    

    致您的$publishProperties,它应该禁用 DoNotDeleteRule MSDeploy 用于保留额外文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      • 2022-07-15
      • 2023-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多