Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Version Number Calculation

Back to Forum: Tech Off
  • User profile image

    You know how when you set the version attribute on your assembly to something like 1.0.* VS.NET auto-increments the version number?

    What's the algorithm to determine a revision versus a build?

    Not at all life-critical - just curious.

  • User profile image

    The Build is number of days from 1.1.2000 and Revision is number of seconds / 2 from that date.

    Here is the code which gets the compilation date from the assembly version:

    System.Reflection.Assembly * = System.Reflection.Assembly.GetExecutingAssembly();

    AssemblyName an = *.GetName();                    

    DateTime d = new DateTime(2000, 1, 1, 3, 0, 0);

    d += TimeSpan.FromDays(an.Version.Build) + TimeSpan.FromSeconds(an.Version.Revision * 2);

    return d.ToString("U");


    Hope it helps.

  • User profile image

    So it's from the date and time of compile? Interesting.


  • User profile image

    Yes, it is.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.