Tom Cohen
Tom Cohen

Reputation: 125

How to change app icon using electron-builder

I changed my app icon and for some reason I can not update the icon (currently has the icon of an electron).

Relevant modules I use:

 "electron-builder": "5.7.0",
 "electron-prebuilt": "^ 1.4.13"

my package.json:

    "build": {
        "appId": "com.siemens.dmv",
        "asar": true,
        "win": {
          "target": "squirrel",
          "icon": "./build/icon.ico",
          "title": "DigitalManufacturingViewer",
          "msi": true,
          "IconUrl": "data: image / png; base64, 
          AAABAyUAJSshACMLBAAeJRAAAw0VAAYPEQAFJzsAE // (long string)
}

I tried several orders without success, does anyone know what command I have to run?

Upvotes: 9

Views: 23709

Answers (3)

Lee
Lee

Reputation: 31090

For Linux,

Place icon.png in the directory /build/icons

https://www.electron.build/icons

Upvotes: 0

Tarak
Tarak

Reputation: 517

Make icon.ico (for Windows and Linux) and icon.icns (for Mac) and place them in the build directory.

Remove the other "icon" properties from the config. the build directory is the default location where electron builder searches for the icons.

Also try updating the electron-builder version. The version you are using is about 2 years old. A lot of features and bugfixes related to icons have been made in the new versions.

Upvotes: 7

Kim T
Kim T

Reputation: 6454

Electron Builder by default looks for assets in the build folder:

./build/
    background.png
    [email protected]
    icon.icns
    icon.ico
    icon.png

Icon names are listed in the docs: https://www.electron.build/icons

You can configure the build folder path in your package.json using:

{
  "name": "your-app",
  "version": "0.0.1",
  "build": {
    "files": [
      "custom/directory"
    ],
    "directories": {
      "buildResources": "custom/directory"
    }
  }
}

Make sure that files are copied using the files attribute. As mentioned in the configuration docs: https://www.electron.build/configuration/configuration#configuration

Upvotes: 5

Related Questions