4

I am building a ASP.Net Web Application within Azure DevOps. When built successfully within the artifacts it creates a .zip file in which all the dll files are. I want to add a file within that .zip file so that particular file is included in the Azure WebApp when I deploy it. Is it possible to add the file to the zip folder?

Murray Foxcroft
  • 12,785
  • 7
  • 58
  • 86
weewoo
  • 135
  • 1
  • 5
  • 10
  • Regarding zip file, how do you build and publish/deploy your project? is it a MSDeploy package? Provide the MSbuild argument here. Regarding the file, is it a existing file or generated during build? – starian chen-MSFT Jul 22 '20 at 13:25

2 Answers2

1

@Murray Foxcroft is correct. The .zip artifact is published by Publish Build Artifacts task, before this task, you could use Copy Files task to copy files from a source folder to a target folder using match patterns, then use Publish Build Artifacts task to publish the target folder.

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • is there a way to see those files in the build pipeline and not the release pipeline? I'm trying to save test data (video) to investigate failed build in vuejs app. I'm using cypress if that matters – TGN12 Feb 20 '21 at 04:40
  • AzureDevOps has one of the worse interfaces I've ever used and I have used a lot of bad ones. The fact that you have to wait minutes to see if your build works is painful. I wonder if MS developer ever dog food their software. Anyway, the answer is below: https://stackoverflow.com/questions/66354931/how-do-i-view-the-contents-of-my-build-artifact-folder-in-azure-dev-ops/66355569?noredirect=1#comment117314387_66355569 – ATL_DEV Mar 01 '21 at 03:25
0

Yes, this is possible.

You need to get your file/s to the

$(build.artifactstagingdirectory)

on the build agent in Azure DevOps during the build in order for them to be included in to the zip (Artefacts).

If the file/s to add is in another repository, you can include this repository in your sources and copy it over. You could also use PowerShell to download the files.

This is usually done using the Copy Files Azure DevOps build task.

steps:
- script: ./buildSomething.sh
- task: CopyFiles@2
  inputs:
    contents: '_buildOutput/**'
    targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
  inputs:
    pathToPublish: $(Build.ArtifactStagingDirectory)
    artifactName: MyBuildOutputs

Top Tips:

Murray Foxcroft
  • 12,785
  • 7
  • 58
  • 86