Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically embed multiple icons in a .NET Executable

I basically have the same issue as this question: Embed multiple icons in WPF EXE

My .NET 2.0 WinForms application currently has this when you click "Change Icon" in explorer:

EVEMon Single Icon
(source: richard-slater.co.uk)

What I would like to see, and with some hacking about as suggested by the above article I get this:

EVEMon Multiple Icons
(source: richard-slater.co.uk)

However the process of getting there all of the version information for the assembly is lost. I need to maintain the Version Information in the assembly as my auto-update process relies on this to identify the installed version of the application.

I also build the application through a continuous integration process so I would prefer not to have any steps that require manual intervention, so is this possible in an automated way?

like image 836
Richard Slater Avatar asked Aug 14 '10 21:08

Richard Slater


2 Answers

I've just created a simple tool to do exactly this without having to mess with .res files. It is a tiny utility which you can use as part of your Post-Build event and lets you add all icon files in a particular folder to your assembly. If we assume that you have a icons folder under your main project folder you can add the following post-build event:

C:\path\to\InsertIcons.exe $(TargetPath) $(ProjectDir)icons

A further description and a download can be found at http://einaregilsson.com/add-multiple-icons-to-a-dotnet-application/

like image 152
Einar Egilsson Avatar answered Oct 17 '22 07:10

Einar Egilsson


The article mentioned by ChrisF will also wipe out your assembly version information. Once you follow that guide you might want to try using the post-build method described here http://blogs.msdn.com/b/cheller/archive/2006/08/24/718757.aspx to embed the manifest.

EDIT:

It is "Method #2 - The "Generic" Approach (using mt.exe)"

like image 44
insipid Avatar answered Oct 17 '22 07:10

insipid