I would like to display the version as yyyy.mm.dd of the last build date to users, how can I accomplish this? relatively new to c#.
Thanks!
I would like to display the version as yyyy.mm.dd of the last build date to users, how can I accomplish this? relatively new to c#.
Thanks!
 
    
    Between HttpContext and System.IO, you can find the location and last modification date of any file within your website
HttpContext (aka Server) has a MapPath() method within it to figure out where you are, and then you can add in the relative location of a particular file. 
    string AppRoot = HttpContext.Current.Server.MapPath(@"\");
    string AppDll = AppRoot + @"bin\MyWebApp.dll"; 
System.IO can then work with that location to get all of the properties about a particular file. In your context you are looking for the Last Modified Date, and here is a simple method to retrieve it:
    public static DateTime GetLastModDate(string FilePath) {
        DateTime retDateTime;
        if (File.Exists(FilePath)) { retDateTime = File.GetLastWriteTime(FilePath); } 
        else { retDateTime = new DateTime(0);  }
        return retDateTime;
    }
Combine these and you get
DateTime LastBuildDate = GetLastModDate(AppDll);
