> So it that 25th January or (will it be) 5th December? :-) The Dec 5th build will be ".1205"... they Jan 5th version was ".105". Version fields in .NET assemblies are 16-bit integers, not strings, so they can't really have leading zeros.
(Ok, I admit, you had me scared for a minute there. ;-) -S On Wed, 26 Jan 2005 06:10:45 -0000, Hewitt, Simon C. (Contractor) <[EMAIL PROTECTED]> wrote: > >....in the form <major>.<minor>.<yyyy>.<mmdd>. Today's build of my > product is "1.0.2005.125". > > So it that 25th January or (will it be) 5th December? :-) > > -----Original Message----- > From: Unmoderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Shawn A. Van > Ness > Sent: 25 January 2005 17:25 > To: [email protected] > > Subject: Re: [ADVANCED-DOTNET] Determing time when a assembly was built > > > Don't you just love it when you get answers explaining exactly how to > > do the two things you specifically said you didn't want to do? :-) > > D'oh! Sorry, I missed that bullet item on the requirements list... > > What I do, in reality, is some combination of my advice and Ian's: I > encode the build date into my version bits, but I don't use the "*" > syntax. I have a little codegen tool which spits out human-readable > versions in the form <major>.<minor>.<yyyy>.<mmdd>. Today's build of my > product is "1.0.2005.125". > > I posted my My X-Code (think: early predecessor to CodeSmith) template > here... scroll down past the rant about when/why/how version numbers > s/b incremented: > http://weblogs.asp.net/savanness/archive/2003/09/17/27906.aspx > > If you want higher fidelity -- the time, not just the date, then I > recommend taking a look at the [AssemblyInformationalVersion] > attribute: > > http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemReflection > AssemblyInformationalVersionAttributeClassTopic.asp > > Unfortunately, I don't think this attribute shows up in the unmanaged > versioninfo resource (which the shell displays in its property-page). -S > > On Tue, 25 Jan 2005 12:21:28 -0000, Ian Griffiths > <[EMAIL PROTECTED]> wrote: > > Don't you just love it when you get answers explaining exactly how to > > do the two things you specifically said you didn't want to do? :-) > > > > Vladimir's solution works, and meets your requirements, but has the > > unfortunate downside that you end up with a multi-module assembly, > > which is less convenient than a normal one-file assembly. > > > > What I'd do is add a pre-build step that generates a C# source file > > containing the information you require. > > > > Here's a particularly low-tech solution. I added this as a prebuild > > event: > > > > echo public class BuildTime { public const string Time = "%TIME%"; > > public const string Date = "%DATE%"; } > $(ProjectDir)Timestamp.cs > > > > I then added Timestamp.cs to my project. > > > > This seems to work with one tiny problem - the date format will be > > determined by the locale of the build machine. Because my machine is > > configured to know that it's in the UK, I get properly formatted > > dates, where the day precedes the months. (DD/MM/YYYY) If however > > you were to run it on an American machine, you would get the curious > > and inexplicable MM/DD/YYYY format instead. :-) > > > > Depending on what you wanted to do with this information, that's > > either not a problem, or a big problem... If you need to control the > > format independently of the build machine locale, then maybe writing a > > > program to spit out the source code would be better than just using > > ECHO... > > > > -- > > Ian Griffiths > > DevelopMentor > > > > > > > -----Original Message----- > > > From: Raj Malli > > > > > > 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? > > > > =================================== > > This list is hosted by DevelopMentor(r) http://www.develop.com > > > > View archives and manage your subscription(s) at > > http://discuss.develop.com > > > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > 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
