We help IT Professionals succeed at work.

Include icons in .net exe file

Medium Priority
Last Modified: 2013-12-17
I am trying to include icons in my .net exe so that I can select those icons for the shell, like setting the icons of shortcuts, icons for some file types, etc...

I tried to include the icons in the Resource files, with different 'Persistance' property set, added icons directly to the solutions with different 'Build Action' property set.

But the only icon that appears in the exe file, when I try to select an icon through the windows explorer is the one that I selected for the application from the project properties.

Please advice.

Watch Question

You can add images as a embedded resource by going to Project properties --> Resources --> Add --> Existing File.

Once added you can reference the image under the Resources namespace.


shazbotOK, I understand what you are saying. But thats now what I want.

Actually, I got my answer from the Microsoft's forum....

MCTS - .net 2.0 Win Apps
The solution

   You have to place the icons in a Win32 resource file (you create it with the Resource Compiler).  You then have to modify the CSPROJ file to include the /win32res flag on the CSC task to point to your Win32 resource file (through the Win32Resource attribute) or you can manually compile your project on the command line and use this flag.

   If you want to specify an icon for your assembly, then you have to use the /win32icon switch, and point to a icon file.

   The documentation for CSC (the executable and task in MSBUILD) has more information.

- Nicholas Paldino [.NET/C# MVP]
Hi Nicholas,
Thanks for your response.

I have created a resource file in Visual C++ 6.0 editor and have also
compiled it to .res file. However, I don't want to compile the project from
the command line every time. So, can you please assist me where should I put
the 'win32res' flag as C# doesn't provide a GUI as C++ to change/add
compiler options.



Hi Ashutosh,

If you're using VS 2005, you can embed the Win32 resource file in the C#
project through the Project Designer.

In detail:
1. Right click the project item in the Solution Explorer and choose
2. In the Project Designer, switch to the Application tab.
3. Select the option 'Resource File' in the Resources group and click the
button on the right to browse to your Win32 resource file.

Hope this helps.
If you have any question, please feel free to let me know.

Linda Liu
Microsoft Online Community Support
Soooo... am I to understand that you want to basically allow your Userbase to be able to change the Icon's within the display of the application?  as in simply referencing a image NOT compiled within the EXE/DLL ??


No, I wanted windows shell (explorer) to access icons in the exe, other than the one that is displayed as the exe's icons.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.