mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Change application & process both name & icon on windows #197
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.icopath 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.
@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 (May 22, 2019):
Implemented in Electron.NET 5.22.12 by the electron.manifest.json file.