How to Modify the Build Number

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

In order to customize the build number in your compiled assemblies, you need to generate the replacement build number and then write it to the assemblyinfo source file.

In order to customize the build number property displayed in the Team Build interface, you need to override the $(BuildNumber) property in the BuildNumberOverride target.

To customize the build number in both the assembly and in the Team Build interface
  1. Override the $(BuildNumber) in the BuildNumberOverride target.
  2. Override the BeforeCompile target to write the AssemblyInfo.cs or .vb file.

 <Target Name="BuildNumberOverrideTarget">
    <Message Importance="High" Text="$(BuildNumber)" />
      <Output TaskParameter="SolutionBuildNumber" PropertyName="SolutionBuildNumber" />
      <Output TaskParameter="TFSBuildNumber" PropertyName="BuildNumber" />
    <Message Importance="High" Text="$(SolutionBuildNumber)" />
    <Message Importance="High" Text="$(BuildNumber)" />
  <Target Name="BeforeCompile">
    <Message Importance="High" Text="$(SolutionBuildNumber)" />
    <CreateItem Include="$(SolutionRoot)\**\AssemblyInfo.cs">
      <Output TaskParameter="Include" ItemName="AssemblyInfoFiles"/>
    <CreateItem Include="$(SolutionRoot)\**\AssemblyInfo.vb">
      <Output TaskParameter="Include" ItemName="AssemblyInfoFiles"/>
      AssemblyInformationalVersionNumber="$(SolutionBuildNumber)" />

Additional Resources

Last edited Jul 26, 2007 at 5:55 AM by prashantbansode, version 1


learnerplates Mar 9, 2009 at 12:26 PM 
where can I find the "ConvertTFSBuildNumberToSolutionBuildNumber" task????
I've installed the AssemblyInfo Task, gotdotnet no longer exists it can now be found here
I've isntalled it but it still cannot find "ConvertTFSBuildNumberToSolutionBuildNumber" !!!!!!!!!!!!!!!!!!

FreeToDev Jul 30, 2008 at 6:26 PM 
A lightweight versioning alternative:!EC3C8F2028D842D5!547.entry