是否可以在“构建步骤"中设置VSTS Build变量,以便可以在后续的“构建步骤"中使用该值? [英] 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?

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

问题描述

我当前在Visual Studio Team Services(以前是Visual Studio Online)中使用Build,并且希望能够在Build步骤中设置Build变量,以便可以在后续的Build步骤中使用新值.

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 Build变量,以便可以在后续的“构建步骤"中使用该值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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