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"; } ///