build: manage version via MinVer with AssemblyInformationalVersion

Uses MinVer to derive the version from git tags (prefix "v"), stored in
AssemblyInformationalVersion. Program.cs reads that attribute (stripping
the "+sha" build metadata) so the update-check compares against a clean
semver. CI overrides the tag via /p:MinVerVersionOverride=$VERSION.
This commit is contained in:
mika kuns
2026-04-23 17:40:01 +02:00
parent 43d517dcfc
commit 373f04a034
3 changed files with 15 additions and 4 deletions

View File

@@ -85,7 +85,10 @@ sealed class Program
sc.AddSingleton(sp =>
{
var releases = sp.GetRequiredService<IReleaseClient>();
var version = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0";
var informational = Assembly.GetEntryAssembly()?
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
// Strip MinVer build metadata ("+sha") and any prerelease suffix for the update-compare.
var version = (informational ?? "0.0.0").Split('+')[0];
return new UpdateCheckService(releases, version);
});