How to fill a shell icon in Visual Studio 2010?

As far as I can tell, there were (at least?) Three types of icon embeddings. There is the original style used by shell32.dll and friends, .NET embedding and a new type that uses WPF. I am looking for how to accomplish the first, since I want to have several other icons available as resources for jumplist that can only accept this style. However, I cannot figure out how to embed this style, only the other two.

How should I do it? All the results that I find in google, etc., are designed to add icons to ResX files or similar.

+2
visual-studio visual-studio-2010 icons embedding
Jun 07 '10 at 20:59
source share
2 answers

I have never heard the term "embed icons." If you are talking about the icon visible for the EXE or DLL in the explorer or shortcut on the desktop: this is done the same way for any Windows program. Both WF and WPF provide the assembly with an unmanaged resource with the selected icon using the / win 32res compilation option. You can see it in Visual Studio with the file + Open + File, select EXE or DLL.

To create a .res file, first create a .rc file. You can create it using the C ++ IDE. Right-click the solution, Add New Project, Visual C ++, Win32, Win32 Console Application. Right-click the folder "Resource Files", "Add + Resource", select "Icon", "Import". select your file. Repeat as necessary. After the build, you will receive a .res file in the project debugging creation directory.

Go back to your C # project, Project + Properties, Application tab. Select the Resource File option and browse to the .res file.

+3
Jun 07 '10 at 21:31
source share

I highly recommend taking a look at this solution posted here ( http://einaregilsson.com/add-multiple-icons-to-a-dotnet-application/ ). It integrates directly into the ms message assembly build event and does not require an unmanaged project (to create an assembly from a .rc / .res file).

This eliminates the dependency on managing the second solution / build anytime you want to refresh the icon and save you IL. Merging a compiled C ++ assembly.

I also recommend taking a look at WIX for your deployment. I wrote a guide that accompanies this answer located here .

+3
May 2 '12 at 2:36 PM
source share



All Articles