azure-devops - 导航到 azure devops 构建服务器中的构建源目录

标签 azure-devops yaml azure-pipelines-yaml azure-pipelines-build-task

我在 Azure DevOps 管道 yaml 文件中使用以下 powershell 来查看 Build.SourcesDirectory 中的所有文件。但是,遇到以下错误。当我尝试浏览构建服务器上的以下目录以调查构建工件时,我没有看到它。如何在 Azure DevOps 发布管道中使用 powershell 导航到 Build.SourcesDirectory。我查看了以下msdn article1 , msdn article2 & msdn article3 .

Powershell:

  - task: PowerShell@2
  - powershell: |
        Get-ChildItem $(Build.SourcesDirectory)
        

错误:

Invalid file path '/home/vsts/work'. A path to a .ps1 file is required.

非常感谢任何指导。

最佳答案

检查PowerShell v2 task 。您必须定义目标类型:

- task: PowerShell@2
  inputs: 
    targetType: 'inline'
    script: |
      Get-ChildItem $(Build.SourcesDirectory)

示例:Write an error

关于azure-devops - 导航到 azure devops 构建服务器中的构建源目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75740111/

相关文章:

azure-devops - 为每个发布环境为 Azure 网站部署转换 web.config

azure - 根据条件设置Azure参数值

azure - 在 Yaml 文件中使用 powershell 内联脚本时出现错误 "while parsing a block mapping did not find expected key"

Azure Pipelines VSBuild 配置无效

azure - 有没有办法防止覆盖 Azure 容器注册表中的现有标签/图像?

azure - 动态创建管道中特定作业的数量

docker - vsts版本-Azure Container Registry Artifact

yaml - 如何在 GItLab CI/CD YAML 值中使用以下空格转义冒号?

go - 解码动态 YAML 以映射结构

Go Yaml 解释示例