public static string GetApplicationVersion(Assembly dll, string format = null)
{
LogHelper.Log.Trace("Toolkit::GetApplicationVersion(dll=[{0}], format='{1}')", dll != null ? dll.GetName().FullName : "null", format);
Version ver = dll.GetName().Version;
string versionOutput = format;
if (String.IsNullOrWhiteSpace(format))
{
versionOutput = ver.ToString();
}
else
{
CheckForAndReplace(ref versionOutput, "{MAJOR}", ver.Major);
CheckForAndReplace(ref versionOutput, "{MINOR}", ver.Minor);
CheckForAndReplace(ref versionOutput, "{REVISION}", ver.Revision);
CheckForAndReplace(ref versionOutput, "{BUILD}", ver.Build);
}
LogHelper.Log.Debug("Formatted application version as '{0}'", versionOutput);
return versionOutput;
}