azureazure-web-app-serviceazure-pipelines-yamlasp.net-core-8

Azure DevOps Pipeline: changes not reflected after ASP.NET Core 8 MVC deployment to Azure web app


I'm deploying an ASP.NET Core 8 MVC appm, deployed to an Azure web app using Azure DevOps. The pipeline runs without errors, but the latest changes don't show up on the live site, even though the commit is correct and the build artifact seems to be generated properly.

Here are the most relevant parts of my pipeline YAML:

trigger:
    - master
    
    pool:
      vmImage: 'windows-latest'
    
    variables:
      - name: solution
        value: '**/*.sln'
      - name: buildConfiguration
        value: 'Release'
      - name: outputPath
        value: '$(build.artifactStagingDirectory)/WebApp'
      - name: webAppZip
        value: 'WebApp_$(Build.BuildNumber).zip'
    
    steps:
    - task: DotNetCoreCLI@2
      displayName: 'Build the project'
      inputs:
        command: 'build'
        projects: '$(solution)'
        arguments: '--configuration $(buildConfiguration) --no-restore'
    
    - task: DotNetCoreCLI@2
      displayName: 'Publish ASP.NET Core MVC project'
      inputs:
        command: 'publish'
        projects: '**/*.csproj'
        arguments: '--configuration $(buildConfiguration) --output $(outputPath) --no-restore'
    
    - task: ArchiveFiles@2
      displayName: 'Zip publish folder for deployment'
      inputs:
        rootFolderOrFile: '$(outputPath)'
        archiveFile: '$(outputPath)/$(webAppZip)'
    
    - task: AzureCLI@2
      displayName: 'Enable cleanup of old files'
      inputs:
        azureSubscription: 'Your-Service-Connection'
        scriptType: 'bash'
        scriptLocation: 'inlineScript'
        inlineScript: |
          az webapp config set \
            --name QA-app\
            --resource-group app \
            --generic-configurations "{\"WEBSITE_CLEANUP_FILES\":\"1\"}"
    
    - task: AzureWebApp@1
      displayName: 'Deploy to Azure Web App'
      inputs:
        azureSubscription: 'Your-Service-Connection'
        appType: 'webApp'
        appName: 'Your-App-Name'
        package: '$(outputPath)/$(webAppZip)'
        deploymentMethod: zipDeploy

Despite all of this, the deployed app still shows the old version.

What I've tried:

What could be causing the deployed app not to reflect the latest build?


Solution

  • Switching from zipping with ArchiveFiles@2 to dotnet publish made the deployment of the web app successful.