Electron default icon missing on Linux (ubuntu 18.04.6 TLS) #756

Closed
opened 2026-01-29 16:47:48 +00:00 by claunia · 4 comments
Owner

Originally created by @mazm786 on GitHub (Jan 27, 2022).

Originally assigned to: @GregorBiswanger on GitHub.

Electron default icon missing on Linux (ubuntu 18.04.6 TLS)

  • 13.5.1:

net 5.0

  • Linux (ubuntu 18.04.6 TLS):

While custom icon setting also failed.

Try 1 (Startup.cs file)

var options = new BrowserWindowOptions { Icon=$"./icon.ico", WebPreferences = new WebPreferences { WebSecurity = false } };

Try 2 (Startup.cs file)

var options = new BrowserWindowOptions { Icon=$"linux_256x256.png", WebPreferences = new WebPreferences { WebSecurity = false } };

Try 3 (Electron.manifest.json file)

{ "executable": "MyElectronMusicPlayer", "build": { "appId": "my.app", "productName": "Electron Music Player", "linux": { "category":"Utility", "icon": "linux_256x256.png" } } }

Originally created by @mazm786 on GitHub (Jan 27, 2022). Originally assigned to: @GregorBiswanger on GitHub. Electron default icon missing on Linux (ubuntu 18.04.6 TLS) <!-- Which version of Electron.NET CLI and API are you using? --> * **13.5.1**: <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> net 5.0 <!-- What target are you building for? --> * **Linux (ubuntu 18.04.6 TLS)**: While custom icon setting also failed. ### Try 1 (Startup.cs file) `var options = new BrowserWindowOptions { Icon=$"./icon.ico", WebPreferences = new WebPreferences { WebSecurity = false } }; ` ### Try 2 (Startup.cs file) `var options = new BrowserWindowOptions { Icon=$"linux_256x256.png", WebPreferences = new WebPreferences { WebSecurity = false } }; ` ### Try 3 (Electron.manifest.json file) ` { "executable": "MyElectronMusicPlayer", "build": { "appId": "my.app", "productName": "Electron Music Player", "linux": { "category":"Utility", "icon": "linux_256x256.png" } } } `
claunia added the bug label 2026-01-29 16:47:48 +00:00
Author
Owner

@danatcofo commented on GitHub (Jan 27, 2022):

@mazm786 the proper way to do it is documented in the electron-builder spec here. I can't tell right off the bat but I think your try 3 is the correct approach. However there is a gotcha that can occur... around pathing due to the electron-builder command not occuring where you might expect it to occur. here is the working path I'm using for my app.

{ "build" : {
"linux": {
      "icon": "../../../../../build/assets/512x512.png",
      ...
} } }

here is my file structure .. if you notice.. there are a couple extra ../s in my path given this file structure

/
/build/assets/512x512.png
/src/myapp/myapp.csproj
/src/myapp/electron.manifest.json

I believe the extra ../s are to account for the electron app actually being built in a deeper folder by electronize. not really clearly documented or documented at all but this was my trial and error outcome.

@danatcofo commented on GitHub (Jan 27, 2022): @mazm786 the proper way to do it is documented in the electron-builder spec [here](https://www.electron.build/icons.html). I can't tell right off the bat but I think your try 3 is the correct approach. However there is a gotcha that can occur... around pathing due to the electron-builder command not occuring where you might expect it to occur. here is the working path I'm using for my app. ``` { "build" : { "linux": { "icon": "../../../../../build/assets/512x512.png", ... } } } ``` here is my file structure .. if you notice.. there are a couple extra `../`s in my path given this file structure ``` / /build/assets/512x512.png /src/myapp/myapp.csproj /src/myapp/electron.manifest.json ``` I believe the extra `../`s are to account for the electron app actually being built in a deeper folder by electronize. not really clearly documented or documented at all but this was my trial and error outcome.
Author
Owner

@danatcofo commented on GitHub (Jan 27, 2022):

Isn't this a duplicate basically of #659 ?

@danatcofo commented on GitHub (Jan 27, 2022): Isn't this a duplicate basically of #659 ?
Author
Owner

@tub5 commented on GitHub (Feb 22, 2022):

It should be said that custom icons in the taskbar won't appear if you're just using electronize start but will appear in the published version

@tub5 commented on GitHub (Feb 22, 2022): It should be said that custom icons in the taskbar won't appear if you're just using `electronize start` but will appear in the published version
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#756