TFS - 预定义变量。 [英] TFS - predefined variables.

查看:105
本文介绍了TFS - 预定义变量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有两个XAML构建定义。他们互相依赖。首先,将drop version构建到文件。第二个版本从文件中获取版本号并添加$(Rev:.r)。我们操纵构建过程模板来处理它。



上周我们决定切换到vNext构建定义。

是否有预定义的可能性vNext构建定义中文件的变量?

解决方案

您好P13X _,



感谢您在此发帖。



在vnext中,您可以在构建定义中设置变量环境或使用预定义您的构建中的变量直接。请检查以下链接:


https:// www .visualstudio.com / zh-CN / docs / build / define / variables


您可以通过以下步骤在Vnext Build中获得相同的结果

1.在构建定义A中设置变量A = 1以表示构建版本(或者您可以使用预定义变量


(Build.BuildId)

(Build.BuildNumber)代表它。)


2。然后在构建定义B中,您可以创建powershell脚本来调用其余的api以从构建定义A获取所有变量(包括变量A = 1),然后再次使用其余的api更新/创建变量for使用Build  A为变量构建B 


您可以参考以下有关如何更新构建定义中的变量的线程:


http:/ /stackoverflow.com/questions/37881017/tfs-ci-build-update-custom-define-variable-after-build-is-succeed



最好的问候


Limitxiao Gao


Hi,
I have two XAML build definitions. They depend on each other. First, build drop version to file. The second build takes version number from a file and adds $(Rev:.r). We manipulate build process template to handle that.

Last week we decide to switch to vNext build definitions.
Is there a possibility to predefined variables from a file in vNext build definitions?

解决方案

Hi P13X_,

Thank you for posting here.

In vnext you could set the variables environments in the build definition or use the predefined variables in your build directly. Please check the following link:

https://www.visualstudio.com/en-us/docs/build/define/variables

You could achieve the same result in Vnext Build by the following steps
1. You set the Variable A = 1 in the build definition A to represent the version of the build( Or you could use the predefined variables


(Build.BuildId)


(Build.BuildNumber ) to represent it).

2. Then in the build definition B, you could create powershell script to call the rest api to get the all variables(include Variable A = 1) from Build Definition A, then use the rest api again to update/create the variable for Build B based on the variables from Build  A.

You could refer to the following thread about how to update the variables in the build definition:

http://stackoverflow.com/questions/37881017/tfs-ci-build-update-custom-define-variable-after-build-is-succeed

Best Regards

Limitxiao Gao


这篇关于TFS - 预定义变量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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