I was not satisfied with the automatic version numbering that VS.Net provided, so I wrote a small app that parsed AssemblyInfo.cs to increment the build number for me (only on successful builds). I invoke that utility in the Post-build event. You could do a similar thing (invoked in the Pre-build event) that parses the source and injects today's date - perhaps into a custom assembly-level attribute (but just as simply into the initializer of a string constant).
Running utilities and parsing files may be "so 20th century" - but it works. :)
You could be even more crude and it would work:
In FileA:
using system;
namespace nsAssemblyBuildDate {
static class CAssemblyBuildDate {
private static string strAssemblyBuildDate = "
In FileB:
";
public static Date AssemblyBuildDate { get { return strAssemblyBuildDate.Trim(); } }
} }
in Post-build event:
type FileA > AssemblyBuildDate.cs
date /t >> AssemblyBuildDate.cs
type FileB >> AssemblyBuildDate.cs
HTH,
Chris
--
Chris Trelawny-Ross
"Dylan Parry" <us****@dylanparry.com> wrote in message news:68***************@dylanparry.com...
Hi,
Is there a way of getting the date that an assembly was last compiled? I
am trying to help myself to remember what version of a particular
assembly my Web applications are using, so I've taken to having it
output the version number at the bottom of the page using:
Assembly a = Assembly.GetExecutingAssembly();
AssemblyName an = a.GetName();
info.InnerHtml = "Powered by " + Info.Name + " v" + an.Version;
But it would be nice if I could have the date shown too so that I can
remember when I actually compiled that particular version.
Cheers,
--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks!