Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# console app. When it starts with Windows, it has no icon

OK, so here's what I've done.

I built a Console application in C#. I gave it an application icon in the property sheet of my .csproj. I build. I run. It's just fine. The icon shows in my taskbar just fine. When I hit Alt+Tab to switch windows, the icon shows there as well.

I added a registry entry in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run so that the console app starts with Windows. When the very same app starts with Windows, it has the default generic console app icon. If I close the app and restart it manually, the correct icon shows in the taskbar.

What the deal?

C#, .Net 4.5, Windows 7 Professional 64-bit

like image 461
Rob Mayo Avatar asked Nov 09 '22 12:11

Rob Mayo


1 Answers

Firstly, you should note that Windows icons come in 4 standard sizes: 16x16, 32x32, 48x48, and 256x256. Any .ico file you use for your application's icon should have the complete set of 4 inside it.

Another possibility is that sometimes the icon cache in Windows gets out of sync with the app's actual icon(s). Updating the app's icon(s) several times may be more likely to trigger this. You might want to try the following instructions to clear the Windows icon cache and allow it to rebuild:

http://www.thewindowsclub.com/rebuild-the-icon-cache-windows

like image 59
Special Sauce Avatar answered Nov 14 '22 22:11

Special Sauce