How to change app icon using electron-builder
Solution 1
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.
Solution 2
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
Tom Cohen
Updated on July 24, 2022Comments
-
Tom Cohen over 1 year
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?