How Change Default Icon #155

Closed
opened 2026-01-29 16:32:32 +00:00 by claunia · 5 comments
Owner

Originally created by @ma9091 on GitHub (May 8, 2018).

Originally assigned to: @robertmuehsig on GitHub.

Originally created by @ma9091 on GitHub (May 8, 2018). Originally assigned to: @robertmuehsig on GitHub.
claunia added the FeatureIn progress labels 2026-01-29 16:32:32 +00:00
Author
Owner

@R00iBaard commented on GitHub (Jun 13, 2018):

I find this crazy you need to fork to be able to do this???

dotnet electronize build /target win /electron-params "--icon="assets/app-icon/win/lci.ico""
I tried this, produces the following which looks right -

electron-packager . --platform=win32 --arch=x64 --icon=assets/app-icon/win/lci.ico --out="C:\Users\davidroux\Halo Software\Halo\DeviceManagement\bin\desktop" --overwrite

However get the following error

Packaging app for platform win32 x64 using electron v1.7.11
WARNING: Found 'electron' but not as a devDependency, pruning anyway
rcedit.exe failed with exit code 1. Cannot open icon file 'a'
Fatal error: Unable to set icon

Also attempted inside startup.cs but not winning there :

var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Center = true, Width = 1152, Height = 864, Show = true, Icon = @"~/assets/app-icon/win/lci.ico" });

@R00iBaard commented on GitHub (Jun 13, 2018): I find this crazy you need to fork to be able to do this??? `dotnet electronize build /target win /electron-params "--icon="assets/app-icon/win/lci.ico""` I tried this, produces the following which looks right - `electron-packager . --platform=win32 --arch=x64 --icon=assets/app-icon/win/lci.ico --out="C:\Users\davidroux\Halo Software\Halo\DeviceManagement\bin\desktop" --overwrite` However get the following error Packaging app for platform win32 x64 using electron v1.7.11 WARNING: Found 'electron' but not as a devDependency, pruning anyway rcedit.exe failed with exit code 1. Cannot open icon file 'a' Fatal error: Unable to set icon Also attempted inside startup.cs but not winning there : ` var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Center = true, Width = 1152, Height = 864, Show = true, Icon = @"~/assets/app-icon/win/lci.ico" });`
Author
Owner

@robertmuehsig commented on GitHub (Jun 13, 2018):

Hi - this is indeed quite stupid to fork the whole project. AFAIK icons are stupid to setup (at least the macOS icons are created in a different way) but I might be wrong here. Could you tell me how the electron-packager needs to be invoked to insert the correct icons?

@robertmuehsig commented on GitHub (Jun 13, 2018): Hi - this is indeed quite stupid to fork the whole project. AFAIK icons are stupid to setup (at least the macOS icons are created in a different way) but I might be wrong here. Could you tell me how the electron-packager needs to be invoked to insert the correct icons?
Author
Owner

@R00iBaard commented on GitHub (Jun 13, 2018):

Hey @robertmuehsig, thanks for the fast reply! I was using this link to figure out what I provided above : https://www.christianengvall.se/electron-packager-tutorial/#windows

@R00iBaard commented on GitHub (Jun 13, 2018): Hey @robertmuehsig, thanks for the fast reply! I was using this link to figure out what I provided above : https://www.christianengvall.se/electron-packager-tutorial/#windows
Author
Owner

@arjo1203 commented on GitHub (Nov 26, 2018):

Hey @ma9091 it looks like there are two issues with the way you are passing the path of the icon to the electron-packager via the ElectronNet command:

  1. The icon path must be an absolute path, just like the --out option
    --out="C:\Users\davidroux\Halo Software\Halo\DeviceManagement\bin\desktop"
  2. You're missing the quotation marks, which is why the system is trying to open 'a' icon file

NOTE how the out path had quotation marks around it

Your example should be modified like so,
--icon=assets/app-icon/win/lci.ico ====> --icon="C:\absolute\path\to\icon.ico"

In order to produce this with ElectronNet, you must format the icon path like so,
"--icon="assets/app-icon/win/lci.ico"" ==> "--icon=\"assets/app-icon/win/lci.ico\""

Doing this, includes the quotation marks and will resolve your issue.

@arjo1203 commented on GitHub (Nov 26, 2018): Hey @ma9091 it looks like there are two issues with the way you are passing the path of the icon to the electron-packager via the ElectronNet command: 1. The icon path must be an absolute path, just like the --out option ` --out="C:\Users\davidroux\Halo Software\Halo\DeviceManagement\bin\desktop"` 2. You're missing the quotation marks, which is why the system is trying to open 'a' icon file **NOTE** how the out path had quotation marks around it Your example should be modified like so, `--icon=assets/app-icon/win/lci.ico` ====> `--icon="C:\absolute\path\to\icon.ico"` In order to produce this with ElectronNet, you must format the icon path like so, `"--icon="assets/app-icon/win/lci.ico""` ==> `"--icon=\"assets/app-icon/win/lci.ico\""` Doing this, includes the quotation marks and will resolve your issue.
Author
Owner

@GregorBiswanger commented on GitHub (May 18, 2019):

Available with the next Electron.NET update.

@GregorBiswanger commented on GitHub (May 18, 2019): Available with the next Electron.NET update.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#155