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