![]() |
Platforms, Frameworks & Libraries »
.NET Framework »
How To
Intermediate
License: The Code Project Open License (CPOL)
Embedding Multiple Icons into .NET ExecutablesBy Ed.PooreA brief walkthrough on how to embed multiple icons (and native resources) into a .NET executable. |
C# 2.0, C# 3.0, VB 8.0, VB 9.0.NET 2.0, Win2K, WinXP, Win2003, Vista, .NET 3.0, WinForms, VS2005, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
I have noticed in various (and lots of) places scattered all across the Internet, requests on how to embed multiple icons into a .NET executable, not embedded in the .NET resources (resx files) but accessible by the Windows Explorer and the like.
After chance comment on a page with nothing to do with the subject at hand, I realised that this capability is built into Visual Studio 2005. This article outlines the procedure required to compile multiple icons into an executable without having to resort to the command-line.
For reasons that shall become apparent later, Visual Studio requires that the icons be compiled into a resource file. It is up to you how you generate this, but I shall use the designers with VS2005.
![]()
![]()
![]()
If you wish, you can change the ID associated with the resources in the Properties window.
![]()
Visual Studio 2005 provides two ways of providing icons for .NET executables. One is via the Application Icon property in the Property pages. The second is via a resource file, and it is this method that we utilise.
![]()
Once the previous step has been completed, Visual Studio will now embed the Win32 resource into the executable when it compiles. To see the changes, simply recompile the application.
![]()
You can see by the above screenshot that multiple icons have been embedded (natively) into the executable. Where this would be useful, for example, is if your application registers a file type, the files can have a different icon associated with them rather than the same as the executable. Or you won't have to distribute an icon file with your program, it can simply be embedded.
Hopefully, that has explained clearly enough how to accomplish the task of embedding multiple icons into a .NET executable without resorting to the command-line. If you have any suggestions for improvements / comments, don't hesitate to post them, I've probably made quite a few spelling mistakes along the way as well (no Intellisense).
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 12 Jul 2007 Editor: Smitha Vijayan |
Copyright 2007 by Ed.Poore Everything else Copyright © CodeProject, 1999-2009 Web13 | Advertise on the Code Project |