Click here to Skip to main content
15,844,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to set icon file for my linux application.

What I have tried:

Here is setting in electron.manifest.json file.

    "linux": {
      "target": "AppImage",
      "icon": "build/icons/linux-256x256.png"

But icon is not set.
Message displayed in VS Code terminal : default Electron icon is used reason=application icon is not set.

While there is no icon. Only red cross displayed
Updated 25-Jan-22 3:21am

Possibly, It’s not a bug. If app don't get the path of icon correct from the "current working folder" (in your case that is build) it defaults to the electron icon and you get the same message. Make sure you got 'build' folder on the same level as your package.json is located.
Take a look at GitHub - electron/electron-packager: Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI[^] and compare your app settings.
Share this answer
DoingWork 25-Jan-22 9:14am    
I am using nuget package and electronize build command for deployment. Will I need to install Electron packager separately ? I am at very beginner level in both ubuntu and Electron.
DoingWork 25-Jan-22 9:19am    
Can you share any sample application that I can test in linux using visual studio code ?
M Imran Ansari 25-Jan-22 9:36am    
Did you check the shared GitHub code link?
For linux I had to end up pointing to the icon in my main root directory of my project.

"linux": {
      "category": "Utility.Passwords",
      "icon": "CYaPass.png",
      "executableName": "cyapass"
    "win": {
      "icon": "build/CYaPass512.png"

You can see that I pointed to the one in the build directory for my windows icon and it worked.

I remember having challenges with this myself but it finally worked when I did it this way.
Share this answer
DoingWork 25-Jan-22 9:16am    
Please elaborate that why icon file (CYaPass.png) for linux is not put in build directory ? while in solution 1, it is being advised that icon file should be in build directory.
raddevus 25-Jan-22 9:55am    
Actually, I can't remember why. I just remember working through this and it was the only way I could get it to finally work. My solution may be related to deploying my app on also. I can't remember now.
Good luck.
DoingWork 27-Jan-22 2:27am    
I have tried it but not working
raddevus 27-Jan-22 11:26am    
I noticed a couple of things about the icon. 1) If I run two copies of my app the first one will display the icon and the other one will display the generic electronjs icon. 2) Your real icon may only display when you run the _real_ copy (not the dev version). Do a build and then try running the deployed version you may see the proper icon.

Also, I struggled with this and with building for all platforms (win,linux, mac) so much I finally found a really nice electron builder and I created a complete project template that even sets up the icon properly.
I created a public github for it at:

Please take a look at that. Clone it, build and see if you see that icon.
There are complete set of instructions there with the project.
let me know if it helps.
raddevus 27-Jan-22 11:33am    
Additional details....
If you just want to try my template out. then...
1) clone it
2) $ npm install
3) $ npm start
You will see the proper icon -- the temporary one that the template uses.

If you do a $ npm run dist it will generate the target exe for your current platform. If you go down into that /dist directory and run the target it will probably not show the icon.
It wants the ICON in the same directory where the EXE starts from.
So if you take the EXE and the app.png and put them in the same directory and then run the app you will see the icon.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900