Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using TFS to generate version header file

Tags:

c++

tfs

We are thinking about adding automatic versioning to a native c++ project being developed and automatically built by Team Foundation Server. Ideally, we would have the build start (which checks out all the newest versions from TFS), then as a first step, get the build number from TFS, create a header file, then check that file back IN before continuing the build. Is this even possible to do a checkout / check-in during a build like that?

I'm not too familiar with how TFS works and the capabilities of retrieving information from it, and neither is anyone else on our team, this is the first time we are using it...

like image 992
Kyle Preiksa Avatar asked Feb 17 '26 08:02

Kyle Preiksa


1 Answers

Yes, you could. Here is a great web site showing how to do it for the AssemblyInfo's for C#, so you'd have to adjust the solution a bit but it should show you enough o complete your task.

Be very careful with Check Out/In in high volume build environment. You will tend to get a lot of "couldn't check out file already locked", and conflicts on check in because another build checked in after this build check out. Use custom tasks with a lot of error handling and verification and the ability to handle conflicts. Do Not Use TF.EXE in a high volume.

Web Site

like image 88
Alex Avatar answered Feb 19 '26 21:02

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!