I can't change the icon

I did a DesktopGL project and I decided to change the taskbar icon, I tried to change the .ico file and the .bmp file but without success, can someone help me?

2 Likes

For DesktopGL, I also had to replace the Icon.bmp file with my own 32-bit BMP with an alpha channel. I had the alpha channel handled with PixelFormer. Hereā€™s a great post on how to do so.

The .ico should work just by replacing it with your own. How are you creating the file?

First I apologize if I have not responded before but I had problems with login page.
I forgot to mention that I tried to edit the monogame icon and change it with the default Icon. For the game icon I used Gimp(When I exported the image, i simply changed the extension) and for the edited file I used Paint.

Gimp (and Photoshop) donā€™t properly support exporting alpha channels with BMP unlike PixelFormer, so if you want proper transparency youā€™ll have to use it or other software that does support it properly. Do the icons remain the same when you change them?

Yes, the icon remain the same.

Try changing the icon in project properties to the new icon even if the name is the same.

The icon is also likely cached which might prevent the new one from displaying. Hereā€™s a guide to clearing the icon cache. I did this before setting the icon to my game.

Ah, you meant this icon, sorry my faultā€¦ This I was able to change it.

I know this may sound like a ā€œkludgeā€ but it works:
Create the icon file in Photoshop and save as a png file; then import this into PixelFormer and export it as an ico file. then simply set it on the projects property page. This worked for me.

I have the same problem: I canā€™t change the icon of the form.

  • I have changed it in the project properties dialog
  • I have deleted the MonoGame icon.ico and icon.bmp
  • I have replaced those by my own

The executable has the correct icon, but the form doesnā€™t. I wonder where the MonoGame icon even comes from now that Iā€™ve deleted it? Pretty stumpedā€¦ thanks!

Hi, I just sorted out the same issue, What worked for me was to add a ā€˜LogicalNameā€™ tag for both the bmp and icon. I got the info from here: Icon for title - #19 by srodrigoDev

3 Likes

Has anyone found a solution to this problem? Since upgrading to MonoGame 3.8 from 3.6, i am experiencing this now too.

I tried the embedded resource / logical name thing from the response above with no luck.

Really confused where the MonoGame icon even comes from.

I have this project with a custom icon: https://github.com/Apostolique/Mitten

You can check in Platforms/DesktopGL/ to check my setup.

4 Likes

Thanksā€¦ I reviewed what you had in your project file and I got this working now. I moved an ApplicationIction section and then added the EmbeddedResource entries for Icon.ico and Icon.bmp. Also had to create the Icon.bmp file which I didnā€™t have previously.

MonoGame appears to use the Icon.bmp file even when you tell it that it should be using Icon.ico and falls back to using a default MonoGame icon it gets from somewhere when you donā€™t have an icon.bmp.

2 Likes

Just to add to this discussion: I had everything set up perfectly, except I renamed my icon to oneons.ico instead of Icon.ico. Surprisingly, it didnā€™t work; renaming it back, did.

Thanks for posting this!

I had a ridiculously hard time with this the last couple of days. Thanks to @Apostolique 's help I can also confirm it finally works.
You need to edit the project file and make sure you have a similar structure as this:

image

Note that probably it will also work without

< CopyToOutputDirectory>Always

Apostolique doesnā€™t have that in his code.

Thanks for this!

Also, kindaā€™ sorry I resurrected this, but I feel a confirmation is always useful for such a problem when someone else searches for it, especially when it is so annoying.

4 Likes

There is also a PR request of mine to fix this, so whenever it getā€™s pushed through future versions will not have the issue Fixes DesktopGL template so Icons display in Window Titlebar and Taskbar by AristurtleDev Ā· Pull Request #8036 Ā· MonoGame/MonoGame Ā· GitHub

2 Likes

Nice, thanks for this. Unfortunately I got excited too soon. True enough, it works for my main application thatā€™s a fantasy computer emulator, but my project also has another application that acts as the debugger of the first. For that one this doesnā€™t work. I suspect itā€™s because the icon name is different, since both of my .exe files eventually end up in the same directory. Iā€™ll continue hammering this.

Yea, the icon needs to be named and Icon.bmp. it specifically looks for this name before falling back to.the embedded default icon.

3 Likes

Precisely, thanks for digging that up! Now, as far as my (a bit exotic) situation, I found two workarounds:

  1. Keep the names of the icons as you wish as long as you make the LogicalName to always be Icon.ico/Icon.bmp
    image

But, I also found a better (at least I find it more elegant) solution:

  1. Create an ā€œiconsā€ directory, place all icons named as you wish there and then just point at them with their relative path, also making sure the logical names are set in stone as Icon.ico/bmp:
    image

I like this one better since it removes a few files from root. I always appreciate that.

2 Likes

Thank you. I had some mess in my project, after I modified it according to you, itā€™s ok :slight_smile:
obrazek