From 1788b5bbee8b821101fe65c36570a8ba3e2671f2 Mon Sep 17 00:00:00 2001 From: PointStar Date: Tue, 12 May 2026 22:59:19 +0300 Subject: [PATCH] =?UTF-8?q?fix(about):=20show=20real=20ClickOnce=20deploym?= =?UTF-8?q?ent=20version=20in=20Settings=20=E2=86=92=20About?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The About tab was always showing "1.0.0" because it read the DLL's AssemblyVersion, which we never bumped in source — even when the ClickOnce manifest had been rolled to 1.1.0 by the CI tag. Read System.Deployment.Application.ApplicationDeployment.CurrentDeployment .CurrentVersion at runtime when the add-in is running under ClickOnce (IsNetworkDeployed=true). That's the version the user actually installed. Fall back to AssemblyVersion when dev-running under F5 (no ClickOnce context). Adds System.Deployment GAC reference to the UI project. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/OutlookAddin.UI/OutlookAddin.UI.csproj | 1 + .../ViewModels/SettingsViewModel.cs | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/OutlookAddin.UI/OutlookAddin.UI.csproj b/src/OutlookAddin.UI/OutlookAddin.UI.csproj index 7dc2aaa..b099036 100644 --- a/src/OutlookAddin.UI/OutlookAddin.UI.csproj +++ b/src/OutlookAddin.UI/OutlookAddin.UI.csproj @@ -18,6 +18,7 @@ + diff --git a/src/OutlookAddin.UI/ViewModels/SettingsViewModel.cs b/src/OutlookAddin.UI/ViewModels/SettingsViewModel.cs index 16e7bb9..07790a2 100644 --- a/src/OutlookAddin.UI/ViewModels/SettingsViewModel.cs +++ b/src/OutlookAddin.UI/ViewModels/SettingsViewModel.cs @@ -70,8 +70,32 @@ namespace MarcusLaw.OutlookAddin.UI.ViewModels Username = creds?.Username ?? string.Empty; InitialApiKey = creds?.ApiKey ?? string.Empty; - var version = typeof(SettingsViewModel).Assembly.GetName().Version?.ToString() ?? "1.0.0"; - VersionLine = $"גרסה {version}"; + VersionLine = $"גרסה {ResolveDisplayVersion()}"; + } + + /// + /// Picks the most accurate version to surface in the About tab: + /// the ClickOnce activation version when the add-in is installed + /// over the wire (auto-updated to the real deployment version), + /// else the assembly's AssemblyVersion (which is set per-source + /// and may lag behind the deployed ClickOnce manifest). + /// + private static string ResolveDisplayVersion() + { + try + { + if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) + { + return System.Deployment.Application.ApplicationDeployment + .CurrentDeployment.CurrentVersion.ToString(); + } + } + catch + { + // Not running under ClickOnce (dev / F5), or System.Deployment + // is not available — fall through to the AssemblyVersion. + } + return typeof(SettingsViewModel).Assembly.GetName().Version?.ToString() ?? "1.0.0"; } ///