Answers: <p>Chris,
  1.Enable diagnostics to get more information
  2.Have you tried the Default value: $(System.DefaultWorkingDirectory)/**/*.zip.?</p>
  <p>Per <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-v1?view=azure-pipelines#inputs" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-v1?view=azure-pipelines#inputs</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2023-10-05T17:34:56.547Z
Answers: 2023-10-05T17:34:56.547Z
Answers: geeky_girl
Body: <p>I have an Azure pipeline for a Blazor project and I'm trying to publish the results of the build to an Azure app service.</p>
  <p>The build completes fine but the deploy task throws an error.  At first I thought it was a problem with one of the paths in the pipeline. be</p>
  <p><a href="https://i.sstatic.net/bnjoe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bnjoe.png" alt="enter image description here" /></a></p>
  <p>Eventually I checked the Azure logs and found this.  This error is what led me to look at the zip file and its empty.</p>
  <p><a href="https://i.sstatic.net/5q460.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5q460.png" alt="enter image description here" /></a></p>
  <p>The pipeline artifact is fine.  When its first created in the build, its also fine.  But
  moving from the build to deploy the zip is 0KB.  My yaml file is below.  If you look at the 2nd Stage which is &quot;Dev&quot;, I'm doing an <code>ls</code> just before that.  I see what I expect</p>
  <p><a href="https://i.sstatic.net/PkJTT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PkJTT.png" alt="enter image description here" /></a></p>
  <p>I do another list in the middle of deployment to Azure and its empty.
  <a href="https://i.sstatic.net/aQcIn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aQcIn.png" alt="enter image description here" /></a></p>
  <p>I haven't been able to find another issue like this anywhere but maybe I'm searching on the wrong keywords.  Any help is greatly appreciated.</p>
  <pre><code>trigger:
  - master
  
  pool:
    vmImage: 'windows-latest'
  
  variables:
    solution: '**/*.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'
    name: $(TeamProject)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:r)
  
  stages:
  - stage: 'Build'
  
    jobs:
    - job: 
      displayName: 'Build the application'
  
      steps:
        - task: NuGetToolInstaller@1
  
        - task: NuGetCommand@2
          displayName: 'Restore NuGet packages'
          inputs:
            restoreSolution: '$(solution)'
            feedsToUse: config
  
        - task: VSBuild@1
          displayName: 'Build'
          inputs:
            solution: '$(solution)'
            msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation=&quot;$(build.artifactStagingDirectory)\WebApp.zip&quot; 
            platform: '$(buildPlatform)'
            configuration: '$(buildConfiguration)'
  
        - task: PublishPipelineArtifact@1
          displayName: 'Publish to $(Pipeline.Workspace)'
          inputs:
            targetPath: '$(Pipeline.Workspace)' 
            artifactName:  'WebApp.zip'
  
        - task: DownloadBuildArtifacts@1
          displayName: 'Download Build Artifacts'
          inputs:
            buildType: current
            project: 'HR3D Engineering'
            pipeline: 'HR Taxonomy'
            artifactName: 'WebApp.zip'
            downloadPath: '$(System.ArtifactsDirectory)' #download to this folder.
  
        - task: CmdLine@2
          inputs:
              script: 'ls -la $(System.ArtifactsDirectory)'
  
  - stage: 'Dev'
    displayName: 'Deploy to the dev environment'
    dependsOn: Build
    condition:  succeeded()
    jobs:
    - deployment: Deploy
      pool:
        vmImage: 'windows-latest'
      environment: ChangeManagement-Dev
      variables:
      - group: Release
      strategy:
        runOnce:
          deploy:
            steps:
            - download: current
              artifact: 'WebApp.zip'
  
            - task: CmdLine@2
              inputs:
                  script: 'ls -la D:\a\1\'
  
            - task: AzureWebApp@1
              displayName: 'Azure App Service Deploy: $(System.ArtifactsStagingDirectory)'
              inputs:
                azureSubscription: 'HR Data Governance(2442165c-339d-4e83-a443-a6583c372938)'  #service connection name
                appType: 'webAppLinux'
                appName: 'HRChangeManagement-Dev' #app service name
                package: 'D:\a\1\WebApp.zip'
  </code></pre>
  
Tags: <azure-devops><azure-pipelines><yaml><azure-artifacts>
Title: Azure pipeline is publishing an empty zip file
UserDisplayName: Chris
ThreadText: # Azure pipeline is publishing an empty zip file
  
  (Asked by: username_0 on 2023-09-29)
  
  I have an Azure pipeline for a Blazor project and I'm trying to publish the results of the build to an Azure app service.
  
  The build completes fine but the deploy task throws an error. At first I thought it was a problem with one of the paths in the pipeline. be
  
  [![enter image description here](https://i.sstatic.net/bnjoe.png)](https://i.sstatic.net/bnjoe.png)
  
  Eventually I checked the Azure logs and found this. This error is what led me to look at the zip file and its empty.
  
  [![enter image description here](https://i.sstatic.net/5q460.png)](https://i.sstatic.net/5q460.png)
  
  The pipeline artifact is fine. When its first created in the build, its also fine. But
  moving from the build to deploy the zip is 0KB. My yaml file is below. If you look at the 2nd Stage which is "Dev", I'm doing an `ls` just before that. I see what I expect
  
  [![enter image description here](https://i.sstatic.net/PkJTT.png)](https://i.sstatic.net/PkJTT.png)
  
  I do another list in the middle of deployment to Azure and its empty.
  [![enter image description here](https://i.sstatic.net/aQcIn.png)](https://i.sstatic.net/aQcIn.png)
  
  I haven't been able to find another issue like this anywhere but maybe I'm searching on the wrong keywords. Any help is greatly appreciated.
  
  ```
  trigger:
  - master
  
  pool:
    vmImage: 'windows-latest'
  
  variables:
    solution: '**/*.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'
    name: $(TeamProject)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:r)
  
  stages:
  - stage: 'Build'
  
    jobs:
    - job: 
      displayName: 'Build the application'
  
      steps:
        - task: NuGetToolInstaller@1
  
        - task: NuGetCommand@2
          displayName: 'Restore NuGet packages'
          inputs:
            restoreSolution: '$(solution)'
            feedsToUse: config
  
        - task: VSBuild@1
          displayName: 'Build'
          inputs:
            solution: '$(solution)'
            msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" 
            platform: '$(buildPlatform)'
            configuration: '$(buildConfiguration)'
  
        - task: PublishPipelineArtifact@1
          displayName: 'Publish to $(Pipeline.Workspace)'
          inputs:
            targetPath: '$(Pipeline.Workspace)' 
            artifactName:  'WebApp.zip'
  
        - task: DownloadBuildArtifacts@1
          displayName: 'Download Build Artifacts'
          inputs:
            buildType: current
            project: 'HR3D Engineering'
            pipeline: 'HR Taxonomy'
            artifactName: 'WebApp.zip'
            downloadPath: '$(System.ArtifactsDirectory)' #download to this folder.
  
        - task: CmdLine@2
          inputs:
              script: 'ls -la $(System.ArtifactsDirectory)'
  
  - stage: 'Dev'
    displayName: 'Deploy to the dev environment'
    dependsOn: Build
    condition:  succeeded()
    jobs:
    - deployment: Deploy
      pool:
        vmImage: 'windows-latest'
      environment: ChangeManagement-Dev
      variables:
      - group: Release
      strategy:
        runOnce:
          deploy:
            steps:
            - download: current
              artifact: 'WebApp.zip'
  
            - task: CmdLine@2
              inputs:
                  script: 'ls -la D:\a\1\'
  
            - task: AzureWebApp@1
              displayName: 'Azure App Service Deploy: $(System.ArtifactsStagingDirectory)'
              inputs:
                azureSubscription: 'HR Data Governance(2442165c-339d-4e83-a443-a6583c372938)'  #service connection name
                appType: 'webAppLinux'
                appName: 'HRChangeManagement-Dev' #app service name
                package: 'D:\a\1\WebApp.zip'
  
  ```
  
  **Tags:** azure-devops, azure-pipelines, yaml, azure-artifacts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-10-05. Score: 0
  
  username_0,
  1.Enable diagnostics to get more information
  2.Have you tried the Default value: $(System.DefaultWorkingDirectory)/\*\*/\*.zip.?
  
  Per <https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-v1?view=azure-pipelines#inputs>
  
  
  ---
  
  