I have done a successful build pipeline of my asp.net website which has packaged my website to $(Build.ArtifactStagingDirectory)
as a zip file.
How do I view the content of this directory via dev.azure.com?
I expected to be able to view it in the Artifacts view but that only show package feeds with no options to view zip files.
Tried to look at Artifacts and copy file to a drop folder - neither of them visible anywhere.
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)'
Contents: '**'
TargetFolder: 'drop'
You should add Publish Build Artifacts task at the end of the build, then the zip
file will be available in the build summary, and you could download it in the release:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
When will you click on the Artifacts you will see the file.
Yeah, finding where files exist when constructing your Pipeline is a bit like trying to build a ship in a bottle. Use the command line task to run a script where you execute a dir command to see a directory's contents. Then you can see the actual files (and paths) echoed in the logs. Something along the lines of
- task: CmdLine@2
displayName: 'Directory listing - Build.ArtifactStagingDirectory'
inputs:
script: |
D:
cd $(Build.ArtifactStagingDirectory)
dir /b /s
I actually can't remember if that directory is on C: or D: so you may have to experiment.
If you using a linux agent(ubuntu-latest for example) the following can help.
- task: CmdLine@2
displayName: 'Directory listing - Build.ArtifactStagingDirectory'
inputs:
script: |
cd $(Build.ArtifactStagingDirectory)
ls -Rla
The output can look something like this.
total 12
drwxr-xr-x 3 vsts docker 4096 Oct 5 09:08 .
drwxr-xr-x 6 vsts docker 4096 Oct 5 09:08 ..
drwxr-xr-x 5 vsts docker 4096 Oct 5 09:08 reactonacraks
./reactonacraks:
total 540
drwxr-xr-x 5 vsts docker 4096 Oct 5 09:08 .
drwxr-xr-x 3 vsts docker 4096 Oct 5 09:08 ..
-rw-r--r-- 1 vsts docker 310 Oct 5 09:08 .gitignore
-rw-r--r-- 1 vsts docker 195 Oct 5 09:08 Dockerfile
-rw-r--r-- 1 vsts docker 223 Oct 5 09:08 Dockerfile.dev
-rw-r--r-- 1 vsts docker 3362 Oct 5 09:08 README.md
drwxr-xr-x 3 vsts docker 4096 Oct 5 09:08 iac
-rw-r--r-- 1 vsts docker 817 Oct 5 09:08 package.json
drwxr-xr-x 2 vsts docker 4096 Oct 5 09:08 public
drwxr-xr-x 2 vsts docker 4096 Oct 5 09:08 src
-rw-r--r-- 1 vsts docker 510352 Oct 5 09:08 yarn.lock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With