public string GetServerInfo(Assembly _assembly)
{
StringBuilder r = new StringBuilder();
try
{
r.AppendLine("Version:" + _assembly.GetName().Version.ToString());
r.Append("Build: " + System.IO.File.GetLastWriteTime(_assembly.Location).ToString("dd/MM/yyyy HH:mm"));
}
catch (Exception ex)
{
Logger.prn(ex);
}
return r.ToString();
}
Then we can call it like this :
Assembly _assembly = Assembly.GetExecutingAssembly();
string info= GetServerInfo(_assembly);