From 373f04a034e2d9b1ab3a046cd37fa25cc1fc833a Mon Sep 17 00:00:00 2001 From: mika kuns Date: Thu, 23 Apr 2026 17:40:01 +0200 Subject: [PATCH] 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. --- .gitea/workflows/release.yml | 6 +++--- Directory.Build.props | 8 ++++++++ src/ClaudeDo.App/Program.cs | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 Directory.Build.props diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 74f3c4d..b6d11f1 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -53,7 +53,7 @@ jobs: cd "$WORK/src" dotnet publish src/ClaudeDo.App/ClaudeDo.App.csproj \ -c Release -r win-x64 --self-contained true \ - /p:Version=$VERSION -o out/app + /p:MinVerVersionOverride=$VERSION -o out/app - name: Publish ClaudeDo.Worker (win-x64, self-contained) env: @@ -65,7 +65,7 @@ jobs: cd "$WORK/src" dotnet publish src/ClaudeDo.Worker/ClaudeDo.Worker.csproj \ -c Release -r win-x64 --self-contained true \ - /p:Version=$VERSION -o out/worker + /p:MinVerVersionOverride=$VERSION -o out/worker - name: Publish ClaudeDo.Installer (win-x64, single-file, framework-dependent) env: @@ -80,7 +80,7 @@ jobs: # Target machines need .NET 8 Desktop Runtime (x64). dotnet publish src/ClaudeDo.Installer/ClaudeDo.Installer.csproj \ -c Release -r win-x64 --self-contained false \ - /p:Version=$VERSION /p:PublishSingleFile=true \ + /p:MinVerVersionOverride=$VERSION /p:PublishSingleFile=true \ -o out/installer - name: Package assets diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..3245073 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,8 @@ + + + v + + + + + diff --git a/src/ClaudeDo.App/Program.cs b/src/ClaudeDo.App/Program.cs index 2c07966..744e823 100644 --- a/src/ClaudeDo.App/Program.cs +++ b/src/ClaudeDo.App/Program.cs @@ -85,7 +85,10 @@ sealed class Program sc.AddSingleton(sp => { var releases = sp.GetRequiredService(); - var version = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0"; + var informational = Assembly.GetEntryAssembly()? + .GetCustomAttribute()?.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); });