How do I insert the latest TFS changeset number into an aspx page? How do I insert the latest TFS changeset number into an aspx page? asp.net asp.net

How do I insert the latest TFS changeset number into an aspx page?


You can use the default version system for assemblies to track revisions number without adding anything in TFS.

If you use the Major.Minor.* format in your AssemblyInfo's AssemblyVersion attribute (e.g. [assembly: AssemblyVersion("1.0.*")]) it will generate a version according to the following format:

Major.Minor.Build.Revision

where

  • Major = Your value
  • Minor = Your value
  • Build = Number of days since2000/01/01
  • Revision = (Number of seconds since midnight on the dayspecified in Build) / 2

This will give you an always increasing number which gives you precise information on build date and time.

To use these values in your code, you can simply recover the version using Assembly.GetExecutingAssembly().GetName().Version.


You can update version number of projects in AssemblyInfo.cs using assembly versioning tools/techniques like this. Version number of an assembly can be updated based on TFS changeset number. Version number then can be displayed in application.


At least when it was released, TFS didn't allow symbol replacement in files which is what I think you're after. I'm not sure if that has changed in more recent versions.