skip to Main Content

I have a dotnet 6 solution which I deploy with azure-devops in Azure Webapp.

this is part of my yml:

            - task: AzureRmWebAppDeployment@4
              displayName: 'Deploy WebApp'
              inputs:
                ConnectionType: 'AzureRM'
                azureSubscription: 'xxx'
                appType: 'webApp'
                WebAppName: 'default-customer'
                deployToSlotOrASE: true
                ResourceGroupName: 'xxx'
                SlotName: 'production'
                enableCustomDeployment: true
                DeploymentType: 'webDeploy'
                packageForLinux: '$(pipeline.workspace)/drop/WebApp.zip'
                JSONFiles: '**/appsettings.json'

it worked for a while but now suddenly when I deploy it didn’t work anymore. Actually it should copy the builded solution into the wwwroot folder. but now when I deploy it show me that is was successful, but, in wwwroot is a archive.xml file and a content folder and there in ‘D_C’-> ‘a’ -> ‘1’-> ‘s’ -> ‘myProjectRoot’-> ‘obj’->release -> net6.0 -> … is my project . and in my log in deploy web app I see that instead of extracting the webapp.zip it call the archive button:

Starting: Deploy WebApp
============================================================================== Task : Azure App Service deploy Description : Deploy to Azure
App Service a web, mobile, or API app using Docker, Java, .NET, .NET
Core, Node.js, PHP, Python, or Ruby Version : 4.231.1 Author
: Microsoft Corporation Help :
https://aka.ms/azureappservicetroubleshooting
============================================================================== Got service connection details for Azure App
Service:’default-customer’ /usr/bin/unzip
/home/vsts/work/1/drop/WebApp.zip -d
/home/vsts/work/_temp/temp_web_package_9100078503110456 Archive:
/home/vsts/work/1/drop/WebApp.zip

do you have any suggestion, why it happen?

2

Answers


  1. Chosen as BEST ANSWER

    I found the problem. The problem was that I have a Web app with windows as operating system but the virtual machine that I referenced in my Yml file was Linux.

    vmImage: 'windows-latest'


  2. You can try to check with the following things to fix the issue:

    1. In the build job, reference below steps to configure your build pipeline.

      Use the DotNetCoreCLI@2 task instead of the VSBuild@1 task (or MSBuild@1 task) to build. If using the VSBuild@1 task (or MSBuild@1 task) to build and generate the ZIP file, the ZIP file will contain the unnecessary folder structure "D_C/a/1/s/myProjectRoot/obj/release/net6.0", just as the issue you are facing.

    jobs:
    - job: build
      displayName: Build
      steps:
      # Build the web app and generate the ZIP file.
      - task: DotNetCoreCLI@2
        displayName: 'dotnet publish'
        inputs:
          command: publish
          projects: 'path/to/WebApp.csproj'
          arguments: '-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory)/WebApp.zip'
    
      # Publish the ZIP file as a pipeline artifact.
      - task: PublishPipelineArtifact@1
        displayName: 'Publish Pipeline Artifact'
        inputs:
          targetPath: '$(Build.ArtifactStagingDirectory)/WebApp.zip'
          artifact: drop
    
    1. In the deploy job (or release pipeline), reference below steps to configure your pipeline.
    steps:
    - task: AzureRmWebAppDeployment@4
      displayName: 'Deploy WebApp'
      inputs:
        ConnectionType: 'AzureRM'
        azureSubscription: 'xxxx'
        appType: 'webApp'
        WebAppName: 'xxxx'
        deployToSlotOrASE: true
        ResourceGroupName: 'xxxx'
        SlotName: 'production'
        enableCustomDeployment: true
        DeploymentType: 'webDeploy'
        packageForLinux: '$(System.DefaultWorkingDirectory)/**/WebApp.zip'
        JSONFiles: '**/appsettings.json'
    

    In addition, if some artifact files existed in the old app version but no longer exist in the new version, and you want to remove the legacy additional files when deploying the new version, on the AzureRmWebAppDeployment@4 task, you can set "RemoveAdditionalFilesFlag: true".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search