diff --git a/src/CodingWithCalvin.VSToolbox/App.xaml.cs b/src/CodingWithCalvin.VSToolbox/App.xaml.cs index 941446f..20a8183 100644 --- a/src/CodingWithCalvin.VSToolbox/App.xaml.cs +++ b/src/CodingWithCalvin.VSToolbox/App.xaml.cs @@ -30,6 +30,13 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) var windowId = Win32Interop.GetWindowIdFromWindow(hwnd); _appWindow = AppWindow.GetFromWindowId(windowId); + // Set the window/taskbar icon + var iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "vs2026_icon.ico"); + if (File.Exists(iconPath)) + { + _appWindow.SetIcon(iconPath); + } + // Set up the main content var rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; diff --git a/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.ico b/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.ico new file mode 100644 index 0000000..7a16c5b Binary files /dev/null and b/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.ico differ diff --git a/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.png b/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.png new file mode 100644 index 0000000..cdeea92 Binary files /dev/null and b/src/CodingWithCalvin.VSToolbox/Assets/vs2026_icon.png differ diff --git a/src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj b/src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj index ed440d6..2986770 100644 --- a/src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj +++ b/src/CodingWithCalvin.VSToolbox/CodingWithCalvin.VSToolbox.csproj @@ -30,6 +30,8 @@ + + diff --git a/src/CodingWithCalvin.VSToolbox/Services/TrayIconService.cs b/src/CodingWithCalvin.VSToolbox/Services/TrayIconService.cs index c7a9a5a..602feef 100644 --- a/src/CodingWithCalvin.VSToolbox/Services/TrayIconService.cs +++ b/src/CodingWithCalvin.VSToolbox/Services/TrayIconService.cs @@ -46,19 +46,24 @@ public void Initialize(Window window) private static Icon? GetAppIcon() { - // Try to get the app's icon from the executable - var exePath = Environment.ProcessPath; - if (!string.IsNullOrEmpty(exePath) && File.Exists(exePath)) + // Try to load the VS icon from Assets + var appDir = AppContext.BaseDirectory; + var iconPath = Path.Combine(appDir, "Assets", "vs2026_icon.png"); + + if (File.Exists(iconPath)) { try { - return Icon.ExtractAssociatedIcon(exePath); + using var bitmap = new Bitmap(iconPath); + var hIcon = bitmap.GetHicon(); + return Icon.FromHandle(hIcon); } catch { // Fall back to default } } + return SystemIcons.Application; }