简体   繁体   中英

TFS: How to reset BuildDetail.BuildNumber?

Simply, I have created multiple builds in Main Branch. However, BuildDetails.BuildNumber is same and incrementing. I know if I branch my code, it would reset to 1.

Q: Is it possible to reset this number for each build without creating branches?

Update: The only option I find up till now is to save my BuildNumber in Version.txt, checked into TFS repository. Checkout this during build, get the number, increment it, use it in versioning, and Checkin the file.
However, still looking for some better solution.

A bit unclear on what you're after. Let me try to explain how build numbers work:

Build "numbers" are generated using the Build Number Format build definition parameter, which by default is $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r) . The $(Rev:.r) part automatically increments, and resets back to 1 when the day change (all this happens separately for each build definition). AFAIK there's no way to reset $(Rev:.r) , nor should there be, because that would case multiple builds with the same build number, which would be confusing.

Rather than having your version number stored in source control you can use the build number generated by TFS.

If you change the format from "$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" to something like "$(BuildDefinitionName)_1.5.$(YY)$(ddd)$(Rev:.r)" then you can set it as part of the build definition.

You can then parse out this number and use it to version your application, and change it how you like by branch, or whatever.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM