Created
February 25, 2025 14:20
-
-
Save georg-jung/90cddc1822cf4673838fcf2ceb1e8258 to your computer and use it in GitHub Desktop.
Human-readable application version with NBGV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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