【发布时间】:2020-09-17 21:09:20
【问题描述】:
在 Azure 管道中,我有一个 Powershell 任务(内联脚本),我在其中设置了一个变量
Write-Host "##vso[task.setvariable variable=deployActivity]false"
紧接着这一行,只是为了检查设置变量的目的,我有以下 powershell -
if ($(deployActivity) -eq $true) {
Write-Host "deployActivity=true (bool)"
}
但是,这失败并出现错误:
deployActivity : The term 'deployActivity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
问题-
- 在上面做什么来检索变量 - 是否正确/可能?还是说一个变量只能在后续任务中引用
- 为什么会失败? Powershell中变量的引用是否需要其他语法?
请告诉我。
谢谢
【问题讨论】:
标签: azure-devops azure-pipelines