Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squirrel Startup Exe Icon missing #1790

Open
AzonInc opened this issue Feb 12, 2022 · 9 comments
Open

Squirrel Startup Exe Icon missing #1790

AzonInc opened this issue Feb 12, 2022 · 9 comments

Comments

@AzonInc
Copy link

AzonInc commented Feb 12, 2022

I'm generating Setup Files witrh the Electron-Forge Squirrel Maker.
However after trying several things and seraching for similar Issues, its not possible to get the App Icon working.

It's still the default Package Icon, which shouldn't be there (see: Restaurant Companion.exe)
image
The Packaged App has the correct Icon assigned (Restaurant Companion.exe, squirrel.exe):
image
The Control Panel Icon is also correct:
image

My Forge Config:

const path = require('path');
const package = require('./package.json');

module.exports = {
  packagerConfig: {
    asar: true,
    icon: path.resolve(__dirname, 'src', 'assets', 'images', 'icon.ico')
  },
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      platforms: ['win32'],
      config: (arch) => {
        return {
          name: 'RestaurantCompanion',
          authors: 'Brogli Informatik GmbH',
          exe: 'Restaurant Companion.exe',
          noMsi: true,
          remoteReleases: '',
          loadingGif: path.resolve(__dirname, 'src', 'assets', 'images', 'setup-animation.gif'),
          setupExe: `RestaurantCompanion-${package.version}-setup-${arch}.exe`,
          setupIcon: path.resolve(__dirname, 'src', 'assets', 'images', 'icon.ico'),
          iconUrl: "https://REMOVED/restaurant-companion/icon.ico",
          signWithParams: process.env['WINDOWS_CODESIGN_ARGS']
        }
      }
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin', 'win32']
    },
    {
      name: '@electron-forge/maker-deb',
      platforms: ['linux']
    },
    {
      name: '@electron-forge/maker-rpm',
      platforms: ['linux']
    }
  ]
};
@easternmotors
Copy link

@AzonInc have you figured out what was going on yourself? I've been looking into it and may have some insight. What does your package.json look like? Specifically the productName and name fields.

@AzonInc
Copy link
Author

AzonInc commented May 7, 2022

Hi, @easternmotors .
I was not able to get it working yet.

Here the relevant package json part:

  "name": "restaurant-companion",
  "productName": "Restaurant Companion",
  "version": "1.6.0-beta.5",
  "description": "Restaurant CMS - Companion App",
  "main": "src/main.js",
  "scripts": {
    "install": "electron-rebuild",
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make --platform win32",
    "publish": "electron-forge publish",
    "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
  },
  "keywords": [],
  "author": {
    "name": "BIT GmbH",
    "email": "[email protected]"
  },
  "license": "MIT",
  "config": {
    "forge": "./forge.config.js"
  },```

@thorsent
Copy link

Did anyone manage to get to the bottom of this? Best we can tell, there may be a stale icon in some registry entry somewhere.

@easternmotors
Copy link

@thorsent no, still experiencing this issue. It only seems to be an issue when one of the variable which has a fallback of packageJSON.name is overwritten (like productName in the example from @AzonInc above -- if not set it defaults to packageJSON.name). If I had to guess, the issue is that somewhere it is pulling the variable from packageJSON.name for a path instead of the custom name being set, causing a failed lookup -- but this is just a guess. I haven't had time in a while to dive into the root cause.

@lukasz-mical
Copy link

@AzonInc, I had a similar issue with the icon and upon doing some research, I discovered that the ID (name in package.json) should not contain dots or spaces. I had a dot in the name, so I changed it to a dash. However, this did not resolve the issue. Then, I tried removing all non-alphabetical characters, and after making this change, the icon started to work properly.

@lggarrison
Copy link

lggarrison commented Nov 27, 2023

I followed @lukasz-mical's advice and removed the spaces from my packagerConfig.name in my forge.config.js

This fixed the setup.exe icon on Windows for me.

@thorsent
Copy link

My support team informs me that some antivirus programs may prevent rcedit from modifying the icon (perceiving it as an attack on an executable). Setting environment variable DEBUG=* causes rcedit to output logs which may help trace when this happens.

Not sure if this is therefore independent of the reported issues with spaces and other non-alphabetical characters.

@panda6412
Copy link

I've encountered an issue with my Electron app where it appears that a variable, which has a fallback to packageJSON.name, is not being correctly overwritten by productName. This is causing problems with path lookups and potentially stale icon entries in the Windows registry.

Context

Here is the relevant part of my package.json:

{
  "name": "deepfakeinspector",
  "productName": "Deepfake Inspector",
  "version": "1.0.2-dev",
  "description": "Stay ahead of deepfakes",
  "main": ".vite/build/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "make:win-arm64": "electron-forge make --arch=arm64",
    "publish": "electron-forge publish",
    "lint": "eslint --ext .ts,.tsx ."
  }
}

And here is my forge.config.ts:

import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';

import { APP_PROTOCOL_NAME } from './src/common/constants';

const config: ForgeConfig = {
  packagerConfig: {
    icon: 'public/images/icon',
    asar: false,
    protocols: [
      {
        name: 'Deepfake Inspector',
        schemes: [APP_PROTOCOL_NAME],
      },
    ],
  },
  rebuildConfig: {},
  makers: [
    new MakerSquirrel({
      setupIcon: 'public/images/icon.ico',
      iconUrl: 'https://d30nwnnt92yl6b.cloudfront.net/icon.ico',
      loadingGif: 'public/images/loading.gif',
      skipUpdateIcon: true,
    }),
    new MakerZIP({}, ['darwin']),
    new MakerRpm({}),
    new MakerDeb({}),
  ],
  plugins: [
    new VitePlugin({
      build: [
        {
          entry: 'src/main/index.ts',
          config: 'vite.main.config.ts',
        },
        {
          entry: 'src/preload/index.ts',
          config: 'vite.preload.config.ts',
        },
      ],
      renderer: [
        {
          name: 'main_window',
          config: 'vite.renderer.config.ts',
        },
      ],
    }),
    new FusesPlugin({
      version: FuseVersion.V1,
      [FuseV1Options.RunAsNode]: false,
      [FuseV1Options.EnableCookieEncryption]: true,
      [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
      [FuseV1Options.EnableNodeCliInspectArguments]: false,
      [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
      [FuseV1Options.OnlyLoadAppFromAsar]: false,
    }),
  ],
};

export default config;

Issue

The problem seems to arise when the productName variable is set. Despite this, somewhere in the build process, it appears to fall back to using packageJSON.name, causing a failed path lookup. This has led to issues such as stale icons in the registry.

Attempts to Resolve

I have tried the following solutions without success:

  • Running ie4uinit.exe -show in the command line and restarting File Explorer.
  • Restarting the computer.

Request for Help

Has anyone else encountered this issue? If so, how did you resolve it? Any insights or solutions would be greatly appreciated.

Thank you!

@nikwen
Copy link

nikwen commented Nov 28, 2024

@panda6412: If it's still helpful for you, I've documented a working setup here: electron-forge/electron-forge-docs#209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants