Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Wednesday, 08 May 2013

To make sure you’re running the correct version of a file – in my case IE10 was caching a xap file (Silverlight) as I was trying to debug what was going on.  Basically I wanted the SL app to display the version number of the dll it was running.

To go from

image

[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

make this change to Properties\AssemblyInfo.cs

  • Major
  • Minor
  • Build – number of days since 1st Jan 2000
  • Revision – number of seconds since midnight/2

To:

image

Then the SL UI can read it:

private string GetAssemblyVersion()
        {
            var assemblyName = new AssemblyName(Application.Current.GetType().Assembly.FullName);

            if (assemblyName == null)
            {
                return string.Empty;
            }

            Version v = assemblyName.Version;

            if (v == null)
            {
                return string.Empty;
            }

            // calculate build date and time too
            int revision = v.Revision;
            var numSecsSinceMidnight = revision*2;
            TimeSpan t = TimeSpan.FromSeconds(numSecsSinceMidnight);

            // Summer time.
            t = t.Add(new TimeSpan(0, 1, 0, 0));

            string timeOfBuild = string.Format("{0:D2}:{1:D2}:{2:D2}",
                t.Hours,
                t.Minutes,
                t.Seconds);

            // Date of build
            int build = v.Build;
            DateTime buildDate = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * build));
            string buildDateBritishFormat = buildDate.ToString("d-MMM-yy");

            var message = v + "   Build Date: " + buildDateBritishFormat + " " + timeOfBuild;

            return message;
        }

image

| | #