-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the problem
When packaging my Electron app on Windows using electron-builder, the generated .exe in win-unpacked still shows the default Electron icon, not my custom icon.
The strange part is:
The installer icon (NSIS) is correct
The app window icon is correct
The uninstaller icon is correct
But the installed application, taskbar icon, Start Menu shortcut, and the .exe file inside win-unpacked/ still use the default Electron icon.
Environment
Electron: 39.2.3
electron-builder: 26.x
Windows 10/11
Node.js: 22.15.1
Correct .ico file provided (contains 256×256, 48×48, 32×32, 16×16 sizes)
What I have tried
Set icon under win in electron-builder config
Set NSIS installer icon (nsis.icon)
Confirmed the .ico file contains multiple sizes
Cleared Windows icon cache
Verified icon.ico path is correct
Rebuilt with --win, --x64, clean build directory
Expected behavior
The packaged .exe should use the custom icon specified in build.win.icon.
Actual behavior
The packaged .exe always shows the default Electron icon, and product metadata (description, company, etc.) are also still showing Electron defaults — seems like the Windows executable is not being processed by electron-builder.
Additional Notes
Even the win-unpacked/MyApp.exe file still has:
Default Electron icon
Default internal metadata ("Product name: Electron")
This suggests electron-builder may not be applying the Windows resource updates.
package.json:
{
"name": "annotation-tool",
"version": "1.0.0",
"main": "main.js",
"type": "module",
"scripts": {
"start": "electron .",
"test": "echo "Error: no test specified" && exit 1",
"build": "electron-builder",
"build:mac": "electron-builder --mac",
"build:win": "electron-builder --win",
"build:linux": "electron-builder --linux"
},
"author": "",
"license": "ISC",
"description": "Image annotation tool",
"devDependencies": {
"electron": "^39.2.3",
"electron-builder": "^26.0.12"
},
"dependencies": {
"electron-log": "^5.4.3",
"electron-store": "^11.0.2"
}
}
electron-builder.yml:
appId: com.example.annotationtool
buildVersion: 1.0.0
copyright: Copyright © 2026 changyong
productName: 标注工具
directories:
output: dist
buildResources: build
files:
- '**/*'
- '!{clear_catch.bat,package.json,.npmrc,electron-builder.yml}'
mac:
target:
- dmg
- zip
icon: build/logo_1024.icns
hardenedRuntime: false
entitlements: null
entitlementsInherit: null
win:
icon: build/logo_256.ico
target:
- nsis
legalTrademarks: "changyong"
signAndEditExecutable: false
fileAssociations: []
nsis:
oneClick: false
allowToChangeInstallationDirectory: true
createDesktopShortcut: true
createStartMenuShortcut: true
shortcutName: 标注工具
artifactName: "${productName}-Setup-${version}.${ext}"
runAfterFinish: true
publish:
provider: github
owner: your-github-username
repo: your-repo-name
releaseType: draft
extraMetadata:
main: main.js