I need Team Build to provide version numbers while performing an incremental build. I need this for both .csproj and .vcproj files. How do I do this?
Evidently Jeff Atwood provided the solution for .csproj projects at a link that no longer works:
blogs.vertigosoftware.com//teamsystem/archive/2006/07/06/Adding_the_Build_Number_to_your_binaries.aspx
I am guessing that what the link had said, is this:
- Obtain a version number, by any desired means (e.g. "version" task from "community tasks"). Set the $(BuildNumber) to the value obtained.
- Modify teambuild.proj "AfterGet" to check-out all assemblyinfo.cs files.
- Use the AssemblyInfo task to bump values
- a) Modify each .csproj to import the AssemblyInfo task, which will be executed if the incremental build chooses to build the .csproj file
- b) Make the AssemblyInfo task use the $(BuildNumber) established in step 1.
- Modify teambuild.proj "AfterCompile" step to checkin all assemblyinfo.cs files.
- Modify teambuild.proj "BeforeOnBuildBreak" to perform an undo of the check-in (in case the build broke).
If I have correctly guessed Jeff's solution, fantastic. But now the question is: how do I accomplish the same thing for .vcproj files? Step 4 above is the problem, since I don't think there is a way to make a .vcproj file execute an arbitrary piece of code (such as the AssemblyInfo task). I'm told this problem is solved in TFS 2010. But what do I do in the mean-time?
Elsewhere I see a strategy for bumping .vcproj related versions, but I'm guessing it will fall short of my needs because I don't think it permits an incremental build. In other words, I think it requires version-bumping and building of all .vcproj files, whether or not they changed.