Just use the "1.0.*" syntax for the AssemblyVersion attribute --
decoding the low-order 32 bits is pretty easy.  Here's a small
JScript.NET program I wrote to do it...

-S

//
// DecodeVer.js
//
import System;

// Parse command line.
var arg1:String = Environment.GetCommandLineArgs()[1];

var members:String[] = arg1.Split('.');
var n:int = members.Length;

var daysSinceY2k:int = Int32.Parse(members[n-2])

var secondsSinceMidnight:int = Int32.Parse(members[n-1]) * 2;

// Establish baseline: Jan 1st, 2000.
var y2k:DateTime = new DateTime(2000,1,1);

// Add days and seconds, as specified.
var date:DateTime = y2k.AddDays(daysSinceY2k).AddSeconds(secondsSinceMidnight);

// Account for DST (Jan 1st 2000 was *not* during DST).
var offset0 = TimeZone.CurrentTimeZone.GetUtcOffset(y2k);
var offset1 = TimeZone.CurrentTimeZone.GetUtcOffset(date);

date += (offset1-offset0);

// Print result.
print(date.ToString("u"));



On Mon, 24 Jan 2005 21:31:06 -0500, Raj Malli <[EMAIL PROTECTED]> wrote:
> Hi guys
> 
> Is there a way by which I can programmatically determine the build time of
> an assembly? I would like to show the following information in the "About"
> box of my application: Application Name, Version and Build Time.
> 
> I do not want to do the following:
>  - Use the last two parts of the assembly version to encode the time
>  - Get the last modified time from the assembly file using (say) the
>    FileInfo class
> 
> In C/C++, this is how I'd have done this:
>  #define BUILD_TIME __TIME__
>  void OnAbout() {
>     ...
>     MessageBox(BUILD_TIME);
>     ...
>  }
> I know C# supports a preprocessor. Can I do something similar to the above
> in C#? Otherwise what other options do I have?
> 
> Thanks
> Raj
> 
> ===================================
> This list is hosted by DevelopMentor�  http://www.develop.com
> 
> View archives and manage your subscription(s) at http://discuss.develop.com
> 


-- 
Cheers,
-Shawn
http://msdn.com/tabletpc
http://windojitsu.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to