Fix missing taskbar/Alt+Tab icon

AppWindow.SetIcon(executablePath) was passing the .exe's own path, but that
API requires an actual .ico file path — passing an .exe silently does
nothing, so the window fell back to a generic placeholder icon in the
taskbar and Alt+Tab (the custom title bar icon fixed earlier is a separate,
XAML-drawn Image and was unaffected).

Embed branding/AmiReel.ico as a resource, extract it once to
%LOCALAPPDATA%\AmiReel\app-icon.ico on startup, and call
AppWindow.SetIcon() with that file path instead. Verified via WM_GETICON
against the running window's HWND that both the big and small icons now
resolve to the real AmiReel logo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 16:38:12 +02:00
parent fc02cd9602
commit f1f1be778b
2 changed files with 37 additions and 4 deletions
+4
View File
@@ -51,6 +51,10 @@
which a single-file self-contained publish bundles into the exe in a way that ms-appx://
can no longer resolve at runtime — this embedded copy sidesteps that entirely. -->
<EmbeddedResource Include="Assets\Square44x44Logo.scale-200.png" LogicalName="AmiReel.Assets.TitleBarIcon.png" />
<!-- Loaded at runtime and extracted to a real .ico file for AppWindow.SetIcon (MainWindow.xaml.cs),
which sets the taskbar/Alt+Tab window icon and requires an actual .ico file path — passing
the .exe path there does not work. Embedding it keeps this independent of publish mode too. -->
<EmbeddedResource Include="branding\AmiReel.ico" LogicalName="AmiReel.Assets.AppIcon.ico" />
</ItemGroup>
<!--