windows-installer icon indicating copy to clipboard operation
windows-installer copied to clipboard

Incorrect .ico used for Desktop and Start menu shortcuts

Open stephendpmurphy opened this issue 5 years ago • 6 comments

Hi all :wave:

I am using Electron Forge (specifically the @electron-forge/maker-squirrel module) to create an installer package for a Win32 architecture. I apologize if this is not the correct place for this issue, but I know "windows-installer" is the underlying module used by Electron Forge which is why I'm here.

I have successfully packaged the application and can install/uninstall it from my machine no problem. However, I have some issues with the Start Menu, Taskbar, and Desktop Shortcut icons.

1.) Executing the app using my npm start (electron-forge start) script

  • Start Menu - Not applicable ➖
  • Desktop Shortcut - Not applicable ➖
  • Taskbar - Icon shows how I would expect. ✔️
  • Add/Remove Program List - Not applicable ➖

2.) First time installing the application using the packaged "app_setup.exe", followed by the application opening for the first time

  • Start Menu - Shortcut created, but uses the Atom icon ❌
  • Desktop Shortcut - Shortcut created, but uses the Atom icon ❌
  • Taskbar - Icons shows how I would expect. ✔️
  • Add/Remove Program List - Icon shows how I would expect. ✔️

3.) nth time executing the app, using the Start Menu or Desktop Shortcut (Not the first time)

  • Start Menu - Shortcut is still the Atom icon ❌
  • Desktop Shortcut - Shortcut is still the Atom icon ❌
  • Taskbar - Icon now shows the Atom icon ❌
  • Add/Remove Program List - Icon shows how I would expect. ✔️

Package versions

electron version: 10.1.4 maker-squirrel version: 6.0.0-beta.54

maker-squirrel config

"config": {
            "authors": "Stephen Murphy",
            "description": "Open-Source Cross-Platform Serial Monitor written using Electron and NodeJS",
            "exe": "serial_dev.exe",
            "name": "serial_dev",
            "noMsi": false,
            "setupExe": "serial_dev_setup.exe",
            "title": "Serial Dev",
            "iconUrl": "https://electronassets.s3.us-east-2.amazonaws.com/thunder_32x32.ico"
          }

Install directory

image

SquirrelSetup Contents

2020-11-14 12:23:54> Program: Starting Squirrel Updater: --createShortcut=serial_dev.exe
2020-11-14 12:23:54> ApplyReleasesImpl: About to create shortcuts for serial_dev.exe, rootAppDir C:\Users\steph\AppData\Local\serial_dev
2020-11-14 12:23:54> ApplyReleasesImpl: Creating shortcut for serial_dev.exe => C:\Users\steph\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc.\serial_dev.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: About to save shortcut: C:\Users\steph\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc.\serial_dev.lnk (target C:\Users\steph\AppData\Local\serial_dev\serial_dev.exe, workingDir C:\Users\steph\AppData\Local\serial_dev\app-1.2.0, args , toastActivatorCSLID aaddbfbd-e30c-5a55-b3aa-1fc98b148508)
2020-11-14 12:23:54> ApplyReleasesImpl: Creating shortcut for serial_dev.exe => C:\Users\steph\Desktop\serial_dev.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: About to save shortcut: C:\Users\steph\Desktop\serial_dev.lnk (target C:\Users\steph\AppData\Local\serial_dev\serial_dev.exe, workingDir C:\Users\steph\AppData\Local\serial_dev\app-1.2.0, args , toastActivatorCSLID aaddbfbd-e30c-5a55-b3aa-1fc98b148508)
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: Altium Designer.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: File Explorer.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: Firefox.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: Visual Studio Code.lnk
2020-11-14 12:23:54> ApplyReleasesImpl: Examining Pin: Windows PowerShell (x86).lnk

stephendpmurphy avatar Nov 14 '20 17:11 stephendpmurphy

Did you check the related issue: https://github.com/Squirrel/Squirrel.Windows/issues/761 ? Does your registry value DisplayIcon at HKEY_CURRENT\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\serial_dev show the correct path? You can e.g. check with windows builtin regedit.exe.

I'm currently embedding my icon as https://github.com/Squirrel/Squirrel.Windows/issues/761#issuecomment-380720836 suggests and stumbled across your issue :)

adabru avatar Apr 12 '21 19:04 adabru

I stumbled upon this issue when researching my own issue over at electron-forge: https://github.com/electron-userland/electron-forge/issues/2569

What you describe here seems to be in line with my findings.

That the taskbar-icon shows up in development, but not in the deployed version is probably because you set it through Electron's new BrowserWindow or .setIcon functionality which seems to be broken in production builds (that's what my issue was about).

The edit/adendum section of my issue covers your other findings:

  • That the icon does show up in Add/Remove programs is explained by Squirrel.Windows using the iconUrl to feed NuGet's (deprecated!) iconUrl property that handles this.
  • That the icon shows up on first run (install) in the taskbar can be explained by the setupIcon-property of the Squirrel maker (even though I don't see it in you config-snippet above). This will cause electron/windows-installer to insert the icon into the installers executable and as such it will show up in the taskbar during installation / first run.

I assume you use mongodb-js/electron-squirrel-startup (implicitly) to create the desktop- and startmenu shortcuts.

Anyway, nothing is setting the icon on the app's executable, so on n-th run the icon doesn't show up in the taskbar. (since also setting it in Electron itself is broken as per my issue).

There are a few ways this would start to work as expected:

  1. electron/windows-installer could use rcedit to insert the iconUrl into the app's executable, the same way it inserts setupIcon into the installers executable
  2. mongodb-js/electron-squirrel-startup could use the uninstall-icon or the iconUrl in the creation of the desktop- and startmenu shortcuts (as in this abandoned PR: mongodb-js/electron-squirrel-startup#10
  3. electron-userland/electron-forge/issues/2569 could be fixed, so that you could at least set the taskbar icon from code (although the shortcuts still wouldn't have the icon)

I don't understand why 1 or 2 or both aren't already implemented this way. It's all a rather confusing situation.

I don't have a solution for you, but I hope this will generate some insights.

karimayachi avatar Oct 11 '21 08:10 karimayachi

@karimayachi thanks for at least continuing the discussion and posting your findings. This issue is rather stale and I haven't touched the source in a minute. I had transitioned to creating .msi installers (I had a need to install on corporate networks and this install flow fit better than the Squirrel installer) so I also lost the need to solve this problem.

I'm still interested in finding the solution however since I prefer the seamless Squirrel installer method.

stephendpmurphy avatar Oct 12 '21 12:10 stephendpmurphy

I am running into this issue here too. As this is now open for 1.5 years and a "correct start menu icon" seems likly to be affecting everyone who creates windows installers, I was wondering if there is any update to this issue.

chickahoona avatar Feb 25 '23 14:02 chickahoona

it is not working for me as well only on the shortcut level , but in the program files and stuff it is working ,

you might wanna check how to reset icons on windows because it sometimes caches.

https://www.makeuseof.com/windows-rebuild-icon-cache/.

but that does not fix the desktop icon issue.

Mgrdich avatar Jun 19 '23 15:06 Mgrdich