‎06-20-2018 08:20 PM
‎06-21-2018 12:53 PM
public static string GetVersion(string path)
{
if (!File.Exists(path)) return null;
var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
var buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
stream.Dispose();
var domain = AppDomain.CreateDomain("TemporaryDomainToLoadVersion");
var assembly = domain.Load(buffer);
var version = assembly.GetName().Version;
var result = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
AppDomain.Unload(domain);
return result;
}
‎06-21-2018 09:58 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now