Azure DevOps Doesn't Publish Web App from ZIP Deploy, Runs It as Read-Only ZIP Package Instead

☆樱花仙子☆ 提交于 2020-01-25 06:55:26

问题


We have an Azure DevOps Pipeline that runs our application as ZIP package https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package as opposed to ZIP Deploy. So we are not able to SFTP into our Web App and change something. Why does the Pipeline runs our application as ZIP package and how can we change this? This is the Pipeline:

trigger: none

pool:
  vmImage: 'windows-latest'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: 'Solution1.sln'

- task: VSBuild@1
  inputs:
    solution: '$(agent.builddirectory)\s\Folder\Project.csproj'
    msbuildArgs: '/p:OutputPath="$(build.binariesDirectory)\Folder\bin" /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:publishUrl="$(build.artifactStagingDirectory)\ProjectTempFolder"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(build.artifactStagingDirectory)\ProjectTempFolder'
    Contents: |
      **
    TargetFolder: '$(build.ArtifactStagingDirectory)\ProjectArtifacts'

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(build.ArtifactStagingDirectory)\ProjectArtifacts'
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(build.ArtifactStagingDirectory)\Project.zip'
    replaceExistingArchive: true

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(build.ArtifactStagingDirectory)\Project.zip'

- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    azureSubscription: 'Subscription1'
    appType: 'webApp'
    WebAppName: 'CoolWebApp777'
    packageForLinux: '$(build.ArtifactStagingDirectory)\Project.zip'

回答1:


Why does the Pipeline runs our application as ZIP package and how can we change this?

It seems you want to disable to run your Web App from a package, AFAIK, the default version in the release pipeline is now set to Version 4. This version has the "Select deployment method" checkbox disabled, which in turn, allows the "Run as Package" feature by default as well. To change this value, go into the "Deploy Azure App Service" task for each environment and expand Additional Deployment Options. You’ll probably want to change it most often to Web Deploy:

Besides, you can turn that off by deleting the WEBSITE_RUN_FROM_ZIP or WEBSITE_RUN_FROM_PACKAGE application setting in the portal.

Note this will clear your web app until the next time you publish.

Hope this helps.



来源:https://stackoverflow.com/questions/59886757/azure-devops-doesnt-publish-web-app-from-zip-deploy-runs-it-as-read-only-zip-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!