Change application & process both name & icon on windows #197

Closed
opened 2026-01-29 16:33:25 +00:00 by claunia · 2 comments
Owner

Originally created by @EldinZenderink on GitHub (Jul 18, 2018).

Originally assigned to: @GregorBiswanger on GitHub.

Alright, I hope this is allowed as I can understand some others might run into the same issue... I have been looking for hours to set the icon and a different app name, until I figured out this build command:

dotnet electronize build /target win /electron-params "--icon=path/to/your/icon.ico MyNewAppName"

*keep in mind, electronnet actually runs the electron-packager command from the following directory:
obj/desktop/*your target*, so when the above command is executed, the actual full path to the ico file for example, would be like: C:\VisualStudio\Projects\MyElectronApp\obj\desktop\*target platform*\path\to\your\icon.ico
path for the icon starts in '/obj/'

At first, the icon didn't change for me... but after reading a bit, i found out that the icon cache might've derped out. You can reset it by following these steps: Resetting icon cache on windows.

After all that, it worked for me :D.

Edit: Running this with target linux and an png icon seems not to work, so I looked at what /resources/app/package.json & package-lock.json said:

With as result on ubuntu 18.04 linux:

After changing that to MyNewAppName, it finally worked:

But still no icon ;x. Going to try and solve that next. In the mean time, I'm probably going to create a custom build script that changes these package.json values after building. I might possibly be doing something wrong here, but so far this was the only solution that worked for me.

Edit 2:

First thing I did was adding the icon through BrowserWindowOptions, did not appear to work.

After meddling with some other ubuntu related stuff and at the point of giving up, I installed electron / npm & node and went into /resources/app directory, started a terminal and ran 'electron main.js'
and there it was, the Icon worked. But going back to the actual executable... no icon. So I honestly have no clue on what is going on. (That said, the electron version installed on ubuntu is v2.0.5, maybe 1.7.11 is causing the issue?)

Anyway, I am going to try another distro and see how that works out.

Originally created by @EldinZenderink on GitHub (Jul 18, 2018). Originally assigned to: @GregorBiswanger on GitHub. Alright, I hope this is allowed as I can understand some others might run into the same issue... I have been looking for hours to set the icon and a different app name, until I figured out this build command: `dotnet electronize build /target win /electron-params "--icon=path/to/your/icon.ico MyNewAppName"` *keep in mind, electronnet actually runs the electron-packager command from the following directory: `obj/desktop/*your target*`, so when the above command is executed, the actual full path to the ico file for example, would be like: `C:\VisualStudio\Projects\MyElectronApp\obj\desktop\*target platform*\path\to\your\icon.ico` path for the icon starts in '/obj/' At first, the icon didn't change for me... but after reading a bit, i found out that the icon cache might've derped out. You can reset it by following these steps: [Resetting icon cache on windows.](https://www.windowscentral.com/how-reset-icon-cache-database-windows-10) After all that, it worked for me :D. Edit: Running this with target linux and an png icon seems not to work, so I looked at what /resources/app/package.json & package-lock.json said: ![](https://i.imgur.com/ydWmNhD.png) With as result on ubuntu 18.04 linux: ![](https://i.imgur.com/83Xaga5.png) After changing that to MyNewAppName, it finally worked: ![](https://i.imgur.com/lcYf66b.png) But still no icon ;x. Going to try and solve that next. In the mean time, I'm probably going to create a custom build script that changes these package.json values after building. I might possibly be doing something wrong here, but so far this was the only solution that worked for me. Edit 2: First thing I did was adding the icon through BrowserWindowOptions, did not appear to work. After meddling with some other ubuntu related stuff and at the point of giving up, I installed electron / npm & node and went into /resources/app directory, started a terminal and ran 'electron main.js' and there it was, the Icon worked. But going back to the actual executable... no icon. So I honestly have no clue on what is going on. (That said, the electron version installed on ubuntu is v2.0.5, maybe 1.7.11 is causing the issue?) Anyway, I am going to try another distro and see how that works out.
claunia added the Featureenhancement labels 2026-01-29 16:33:25 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Sep 25, 2018):

@robertmuehsig we can add this feature with the electron.manifest.json file.. you can do that for the package.json with the CLI?

@GregorBiswanger commented on GitHub (Sep 25, 2018): @robertmuehsig we can add this feature with the electron.manifest.json file.. you can do that for the package.json with the CLI?
Author
Owner

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

Implemented in Electron.NET 5.22.12 by the electron.manifest.json file.

@GregorBiswanger commented on GitHub (May 22, 2019): Implemented in Electron.NET 5.22.12 by the electron.manifest.json file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#197