Azure Devops Piepeline-Yaml Powershell脚本路径

Azure Devops Piepeline-Yaml Powershell脚本路径,azure,yaml,azure-pipelines,azure-pipelines-yaml,Azure,Yaml,Azure Pipelines,Azure Pipelines Yaml,我想问一下,是否有人知道如何使用Azure Devops管道Yaml语法创建到powershell的正确路径 我的YAML看起来怎么样(目前): 我的目录看起来如何: 什么样的路径返回管道: 获取内容:/home/vsts/work/1/s/scripts/script.ps1:12 返回管道的错误类型: ##[错误]PowerShell已退出,代码为“1” 需要查看发布任务的外观以及相对路径的外观。尝试添加-powershell Get ChildItem-Path$(Build.Artif

我想问一下,是否有人知道如何使用Azure Devops管道Yaml语法创建到powershell的正确路径

我的YAML看起来怎么样(目前):

我的目录看起来如何:

什么样的路径返回管道:

获取内容:/home/vsts/work/1/s/scripts/script.ps1:12

返回管道的错误类型:

##[错误]PowerShell已退出,代码为“1”


需要查看发布任务的外观以及相对路径的外观。尝试添加
-powershell Get ChildItem-Path$(Build.ArtifactStagingDirectory)-recurse
这将列出所有路径,以便您可以查看脚本的完整路径

我想问你是否有人知道如何创建正确的路径 到Azure Devops管道Yaml语法中的powershell

并不是PS找不到您的脚本,而是错误消息表明xx.ps1文件中的第12行有问题

在您在此处共享脚本内容之前,我无法找到问题。我的建议是,您应该使用
System.Debug=true再次运行管道。要获得详细的错误消息,您应该在那里得到提示。

正确答案:

- task: PowerShell@2
  inputs:
    filePath: '$(Agent.BuildDirectory)/s/scripts/script.ps1'
- task: PowerShell@2
  inputs:
    filePath: '$(Agent.BuildDirectory)/s/scripts/script.ps1'