Skip to content

Instantly share code, notes, and snippets.

@georg-jung
Created February 25, 2025 14:20
Show Gist options
  • Save georg-jung/90cddc1822cf4673838fcf2ceb1e8258 to your computer and use it in GitHub Desktop.
Save georg-jung/90cddc1822cf4673838fcf2ceb1e8258 to your computer and use it in GitHub Desktop.
Human-readable application version with NBGV
internal static partial class ThisAssembly
{
internal const string ProductIdentity = AssemblyName + "-" + AssemblyInformationalVersion;
/// <summary>
/// AssemblyInformationalVersion without the git commit hash.
/// </summary>
internal static readonly string HumanReadableVersion = GetHumanReadableVersion();
private static string GetHumanReadableVersion()
{
var idx = AssemblyInformationalVersion.IndexOf('+', StringComparison.Ordinal);
if (idx > 0)
{
return AssemblyInformationalVersion.Substring(0, idx);
}
return AssemblyInformationalVersion;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment