Electron-forge: Squirrel.Windows maker: setupIcon config not working

Created on 18 Apr 2020  路  10Comments  路  Source: electron-userland/electron-forge

The documentation states you can change the icon of the Setup installer application using the setupIcon option. It doesn't seem to do anything. The iconUrl option works however, even when they are pointed to the same resource.

Bug

All 10 comments

~Yeah I also can't tell what's happening with the icon. It would be great to see some examples in the documentation about this.~

This is embarrassing. I didn't have my configuration in a config object.

This is my config

  makers: [
    {
      name: "@electron-forge/maker-squirrel",
      config: {
        loadingGif: "build/icon2.gif",
        setupIcon: "build/icon.ico"
      }
    }
  ],

Previously it was

  makers: [
    {
      name: "@electron-forge/maker-squirrel",
      loadingGif: "build/icon2.gif",
      setupIcon: "build/icon.ico"
    }
  ],

My config is working now. Are you still having issues? Could you post the relevant part of your config?

Mine looks like this:


        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "my.app",
            "setupIcon": __dirname + "/assets/icon.ico",
            "iconUrl": __dirname + "/assets/icon.ico",
          }
        },

Is your config a js file?

In general it's better practice to use path.join or path.resolve when dealing with paths.

If your config is in js format then you can log the calculated result to see if it's the correct location.

If it's absolutely correct then I'm not quite sure what to do from there

Yes

For me, "iconUrl": __dirname + "/assets/icon.ico", works perfectly.
setupIcon is the same value.

I can't reproduce this behavior. I have a testcase here: https://github.com/malept/electron-forge-demo123/tree/forge6-issue-1635

I had GitHub Actions build a Squirrel installer here: https://github.com/malept/electron-forge-demo123/actions/runs/116519042

It shows the correct icons both when I run the setup file and when I uninstall the app.

If you can provide a minimal testcase repository that shows the behavior you describe, please link it here and we can see if it is a bug in Electron Forge (or more likely, if it's a bug, it's in electron-winstaller or Squirrel.Windows).

@malept
TL;DR Read my Edit at the bottom of this comment for solution I found.

I am having the same difficulty with setupIcon.
Could someone please post a very obvious example of the final path?
Like what does a absolute setupIcon path should look like?

I'm trying all of the above examples and it never finds the image path (Fatal error: Unable to load file).

Here's what I'm doing (and I've tried atleast 30 variations)

    'makers': [
        {
            'name': '@electron-forge/maker-squirrel', //https://js.electronforge.io/maker/squirrel/interfaces/makersquirrelconfig
            'config': {
                'name': 'Finance-D',
                'setupExe': 'Finance D - Installation.exe',
                'setupIcon': path.join('resources', 'app', 'src', 'images', 'favicon.ico'),
            }
        },

output directory structure:
phpstorm64_TqX7GJuVrZ
source directory structure:
phpstorm64_s3ayS5LUG5

Where is the maker-squirel module looking at. I don't understand why it fails with even absolute paths and relative, etc.

EDIT: I found a hidden property somewhere on the internet and it fixes the problem! It's unexpected but adding the skipUpdateIcon:true property in the configs will work even for the same exact setupIcon path.... wierd.
So, I'm refering to this https://js.electronforge.io/maker/squirrel/interfaces/makersquirrelconfig#setupicon
and my solution right now is:

    'makers': [
        {
            'name': '@electron-forge/maker-squirrel', //https://js.electronforge.io/maker/squirrel/interfaces/makersquirrelconfig
            'config': {
                'name': 'Finance-D',
                'setupIcon': path.join(__dirname, '/src/images/favicon.ico'),
                'skipUpdateIcon': true,
            }
        },

Hi @pjebs could you give me a direction on how to use config as a .js file, I couldn't find docs about that

@LeonardoRick https://www.electronforge.io/configuration and click on the "Path" tab

@malept omg thank you so much

Was this page helpful?
0 / 5 - 0 ratings