Results 1 to 11 of 11

Thread: How to get the application last compiled date? [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    London
    Posts
    63

    How to get the application last compiled date? [Resolved]

    I have a C# Windows app and wanted to put a label on the login screen with the last compiled date;


    ie. Release Date : 22/06/2004

    anyone know if this can be done, and if so what holds the app last compiled date?
    Last edited by Genie; Jun 23rd, 2004 at 05:35 AM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    hello mate. i've got an exception error of URI formats are not supported.. am i missing something? thanx...

  4. #4
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    got it mate. sorry for bothers.
    PHP Code:
             System.IO.FileInfo fi=new System.IO.FileInfo(
                
    Environment.CurrentDirectory+@"\ConsoleApplication14.exe");
             
    Console.WriteLine(fi.LastWriteTime.ToLongDateString().ToString()); 
    thanks

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Or this way :
    PHP Code:
    string exeName Assembly.GetExecutingAssembly().GetName().Name;                    
                
    string exePath Path.Combine(Application.ExecutablePath ,exeName);
                
    FileInfo fi = new FileInfo(exePath);
                
    DateTime buildDate fi.LastWriteTime;
                
    MessageBox.Show(buildDate.ToString()); 

  6. #6
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    pardon my stupidity mate, but i've got a date way before titanic was built. lol. am i missing something? it says... 1/1/1601 8:00:00 AM. thanks

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    London
    Posts
    63
    got it:


    string exePath = Application.ExecutablePath;
    System.IO.FileInfo fi = new System.IO.FileInfo(exePath);
    DateTime buildDate = fi.LastWriteTime;
    MessageBox.Show(buildDate.ToString());


    Application.ExecutablePath seems to give you the complete path including exe name.

    Thanks.

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Genie

    Application.ExecutablePath seems to give you the complete path including exe name.
    Thanks.
    oops . I don't know how I missed this one...

  9. #9
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    gee... thanks

  10. #10
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    Sorry about the stupidity but if you copy your exe to a ftp or something like that, the lastwritetime will change to the exact moment where the file is created on the other side so the date your program shows might be screwed..or not?

    \m/\m/

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by PT Exorcist
    Sorry about the stupidity but if you copy your exe to a ftp or something like that, the lastwritetime will change to the exact moment where the file is created on the other side so the date your program shows might be screwed..or not?
    public DateTime LastWriteTime {get; set;}

    Gets or sets the time when the current file or directory was last
    written to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width