I am using VS.NET 2003 and C# to develop a Windows Forms application targeted
at Windows XP. I would like to automatically capture the build time and date
such that it can be displayed by the application, for example as part of the
About form.

Is there a way to configure VS.NET to capture this information and place it
in a variable or resource file such that it is available at runtime after
distribution?

Thanks,
Dave

Re: How to display application build time at runtime? by Ryan

Ryan
Mon Jan 24 17:51:35 CST 2005

> I am using VS.NET 2003 and C# to develop a Windows Forms application
> targeted at Windows XP. I would like to automatically capture the
> build time and date such that it can be displayed by the application,
> for example as part of the About form.
>
> Is there a way to configure VS.NET to capture this information and
> place it in a variable or resource file such that it is available at
> runtime after distribution?

In general, something like this should work:

using System.Reflection;
using System.IO;

Assembly assembly = Assembly.GetExecutingAssembly();
FileInfo info = new FileInfo(assembly.Location);
Console.WriteLine(info.CreationTime);




Re: How to display application build time at runtime? by babel

babel
Tue Jan 25 16:15:07 CST 2005

Ryan,

Thanks for the suggestion, but the date being returned is much older than
the last build time. For example, I built and ran the code today (1/25/2005)
but the date returned was 12/22/2004. I am really looking for something
related to the time when the solution was built, not when an assembly might
have last been created or modified.

Thanks,
Dave

"Ryan Trudelle-Schwarz" wrote:

> > I am using VS.NET 2003 and C# to develop a Windows Forms application
> > targeted at Windows XP. I would like to automatically capture the
> > build time and date such that it can be displayed by the application,
> > for example as part of the About form.
> >
> > Is there a way to configure VS.NET to capture this information and
> > place it in a variable or resource file such that it is available at
> > runtime after distribution?
>
> In general, something like this should work:
>
> using System.Reflection;
> using System.IO;
>
> Assembly assembly = Assembly.GetExecutingAssembly();
> FileInfo info = new FileInfo(assembly.Location);
> Console.WriteLine(info.CreationTime);
>
>
>
>