是否可以在构建步骤中设置 VSTS 构建变量,以便可以在后续构建步骤中使用该值? [英] Is it possible to set an VSTS Build variable in a Build Step so that the value can be used in a subsequent Build Step?

查看:31
本文介绍了是否可以在构建步骤中设置 VSTS 构建变量,以便可以在后续构建步骤中使用该值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在 Visual Studio Team Services 中使用 Build(以前是 Visual Studio Online),并且希望能够在 Build Step 中设置 Build Variable,以便可以在后续 Build Step 中使用新值.

I'm currently using Build in Visual Studio Team Services (was Visual Studio Online), and would like to be able to set a Build Variable in a Build Step so that the new value can be used in a subsequent Build Step.

显然您可以在构建开始之前设置它,但我希望在随后的构建步骤中延迟绑定变量.

Obviously you can set it before the Build starts but I'm looking to late bind the variable during a subsequent Build Step.

这可能吗?

推荐答案

在脚本内部时,您可以通过在 ps1 中发出以下内容来更新变量

When inside of a script you can update a variable by emitting the following in your ps1

"##vso[task.setvariable variable=testvar;]testvalue"

然后您可以使用 $(testvar)

这篇关于是否可以在构建步骤中设置 VSTS 构建变量,以便可以在后续构建步骤中使用该值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆