I have a WPF solution, compiled to 2 .exe files, A.exe and B.exe.
A.exe, everything is fine.
B.exe, during running time, the top left corner shows the icon properly, but when viewed in File Explorer or shown in “Start->Program Files->B” menu, the icon is empty.
I’m a bit lost how to debug this issue:
- apparently the resource is there, as running time the icon appears in the window;
- i can’t find a way to debug the procedure of “File Explorer detecting icons in .exe file”, no log, no breaking point;
- Some strange things: previously the scenario is reversed, B.exe is fine, while A.exe has problem; then my guys keep on coding, and one day it reverted…
I used CodeReflect to see what is inside A.exe and B.exe, it shows
A
- A.exe // codes inside
- Resources
- A.g.resources
- appicon.ico
- app.baml
- A.Properties.Resources.resources
B
- B.exe // codes inside
- Resources
- EnhauncedByPostSharp // nothing is listed
- PostSharp.Aspects.814640628.1 // binary things listed
- B.g.resources
- appicon2.ico
- app.baml
- resource/iconresource.xaml
- resource/datatemplates/views/ControlElementsDataTemplates.baml
- Views/B.baml
- ... and other baml files
- B.Properties.Resources.resources
I ‘m not sure how PostSharp jumped into place. Yes we use PostSharp but it’s a blackbox to me…
Appreciate if you guys could shed some light here…. thanks!
You need to set the icon in the Project Properties. The EXE icon does not by default use the main window’s icon.
Right click on the EXE project in visual studio, go to Properties, and (assuming that you are using Visual Studio 2010), there is a dropdown in the Application tab titled “Icon”. You need to set your icon there.