【发布时间】:2017-10-10 18:01:34
【问题描述】:
我正在使用 Visual Studio TFS 服务并想运行一个 powershell,更新一个变量并将其用于另一个任务。
我的构建定义只有 2 个 powershell 任务和 1 个变量 (NugetEnabled),默认值为“dontpush”。
构建变量:NugetEnabled(值:“dontpush”)
任务 1:Powershell 脚本
##vso[task.setvariable variable=NugetEnabled;]push
任务 2:Powershell 脚本
$value= $env:NugetEnabled
if ($value)
{
Write-Output "Value of the nuget is set and equals to $value"
}
else
{
Write-Output "Value of the nuget doesn't exists."
}
输出控制台写道:
"Value of the nuget is set and equals to dontpush"
预期值:“推”。
我无法更新该值。我想更新值,因为我想使用“自定义条件”来推送我的 nuget 包。
完整的powershell脚本is hosted in github和我的代理版本是2.116.1
提前致谢! 任何建议都会受到赞赏和有用。
【问题讨论】:
-
我用
Write-Output ("##vso[task.setvariable variable=NugetEnabled;]push")更改了命令并且完美运行!...
标签: powershell tfs continuous-integration