在TFS构建期间访问Powershell脚本中的内部修订版本号 [英] Accessing the build revision number in Powershell script during TFS build

查看:57
本文介绍了在TFS构建期间访问Powershell脚本中的内部修订版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从IBuildDetail.BuildNumber中获取内部版本号,但这是从内部版本定义中获取的,因此前面可能没有版本号$(Rev:.r),也可能没有结尾.

I can get the build number from IBuildDetail.BuildNumber but this is taken from the build definition and there fore might not include the revision number $(Rev:.r) or it might not be at the end.

因此,我希望获得此编号而不必从内部版本号解析它.在构建过程中的任何地方都可以使用此属性吗?

So I would like to get this number without having to parse it from the build number. Is this property available any where during the build?

推荐答案

使用如果您使用的是TFS 2015,请在PowerShell中使用$Env:BUILD_BUILDNUMBER.

From PowerShell use $Env:BUILD_BUILDNUMBER if you’re using TFS 2015.

请参阅MSDN: 使用PowerShell脚本自定义您的构建过程

See MSDN: Use a PowerShell script to customize your build process

对于以前的版本: 团队基金会构建环境变量

For previous versions: Team Foundation Build environment variables

这篇关于在TFS构建期间访问Powershell脚本中的内部修订版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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