fix(about): show real ClickOnce deployment version in Settings → About
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) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -70,8 +70,32 @@ namespace MarcusLaw.OutlookAddin.UI.ViewModels
|
|||||||
Username = creds?.Username ?? string.Empty;
|
Username = creds?.Username ?? string.Empty;
|
||||||
InitialApiKey = creds?.ApiKey ?? string.Empty;
|
InitialApiKey = creds?.ApiKey ?? string.Empty;
|
||||||
|
|
||||||
var version = typeof(SettingsViewModel).Assembly.GetName().Version?.ToString() ?? "1.0.0";
|
VersionLine = $"גרסה {ResolveDisplayVersion()}";
|
||||||
VersionLine = $"גרסה {version}";
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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).
|
||||||
|
/// </summary>
|
||||||
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user