简体   繁体   English

在 Azure Dev Ops 上:如何查看 package 位置目录 $(Build.ArtifactStagingDirectory) 的内容

[英]On Azure Dev Ops: How do I view the content of the package location directory $(Build.ArtifactStagingDirectory)

I have done a successful build pipeline of my asp.net website which has packaged my website to $(Build.ArtifactStagingDirectory) as a zip file.我已经成功构建了我的 asp.net 网站,该网站已将我的网站打包到$(Build.ArtifactStagingDirectory)作为 zip 文件。 How do I view the content of this directory via dev.azure.com?如何通过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.我希望能够在 Artifacts 视图中查看它,但它只显示 package 提要,没有查看 zip 文件的选项。

Tried to look at Artifacts and copy file to a drop folder - neither of them visible anywhere.试图查看 Artifacts 并将文件复制到放置文件夹 - 它们在任何地方都不可见。

- 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'

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.使用命令行任务运行脚本,您可以在其中执行 dir 命令以查看目录的内容。 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.我实际上不记得该目录是否位于 C: 或 D: 上,因此您可能需要进行试验。

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:您应该在构建结束时添加Publish Build Artifacts任务,然后zip文件将在构建摘要中可用,您可以在发布中下载它:

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'

在此处输入图像描述

When will you click on the Artifacts you will see the file.您什么时候点击工件,您将看到该文件。

If you using a linux agent( ubuntu-latest for example) the following can help.如果您使用 linux 代理(例如ubuntu-latest ),以下可以提供帮助。

    - task: CmdLine@2
      displayName: 'Directory listing - Build.ArtifactStagingDirectory'
      inputs:
        script: |
          cd $(Build.ArtifactStagingDirectory)
          ls -Rla

The output can look something like this. output 可能看起来像这样。

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

I have a dumb little workaround I just used.我刚刚使用了一个愚蠢的小解决方法。

I added a command line task to my build pipeline.我在构建管道中添加了一个命令行任务。 在此处输入图像描述

I then expanded the advanced options and clicked on the ellipses beside the option to view my working directory.然后我展开高级选项并单击选项旁边的省略号以查看我的工作目录。 在此处输入图像描述

I think this does what you're asking for.我认为这可以满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 为 Windows 服务构建任务:- $(build.artifactstagingdirectory) 下没有 zip - Azure Build task for Windows Service :- no zip under $(build.artifactstagingdirectory) build.artifactstaging 目录不存在 Azure Devops - build.artifactstagingdirectory doesn't exist Azure Devops 我可以直接将文件保存到 $(Build.ArtifactStagingDirectory) 并发布它们吗? - Can I save files directly to $(Build.ArtifactStagingDirectory) and publish them? 复制 msbuild 之后的文件复制到根文件夹 $(build.ArtifactStagingDirectory) - Copying files after the msbuild do copy to the root folder $(build.ArtifactStagingDirectory) msbuild 参数 /p:OutDir="$(build.artifactstagingdirectory)" 导致某些项目错过“bin/release”文件夹 - msbuild argument /p:OutDir="$(build.artifactstagingdirectory)" causing some projects to miss "bin/release" folder 如何将任务添加到 azure dev ops starter? - How to add tasks to azure dev ops starter? 如何从 node.js package.json 文件克隆 Azure Dev Ops 存储库? - How to clone a Azure Dev Ops repo from node.js package.json file? Azure Dev Ops Build Agent的内部版本和发行版 - Azure Dev Ops Build Agent's builds and releases used 为什么我的 Azure Dev Ops Pipeline 无法恢复 package? - Why is my Azure Dev Ops Pipeline failing to restore a package? 反应原生 azure 开发操作管道构建失败 - react native azure dev ops pipeline build failure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM