Lazlo
Lazlo

Reputation: 8780

Multiple icons in executable in VS2010

I have Googled and found multiple ways of adding multiple icons into the executable, but they all seem to work for VS 2003-2005-2008, nothing for VS2010. I have not tried the Win32 resource with /win32res because I do not know how to use it (can't figure to get a good Google result for that either).

Any simple suggestion?

Upvotes: 8

Views: 3373

Answers (4)

Michael Erickson
Michael Erickson

Reputation: 4445

The Code Project article explains how to create a "assemblyWin32.res" file.

https://www.codeproject.com/Tips/160885/%2fTips%2f160885%2fHow-to-Embed-Multiple-Icons-and-Color-Animated-Cur

Upvotes: 0

Mojtaba Rezaeian
Mojtaba Rezaeian

Reputation: 8736

If you're using visual studio 2012:

  • For C#.NET Here I found a good solution for this problem for c# projects as an example. But it only works in my C# projects

    1. Create a new "Native Resource Template" from the File | New dialog box.
    2. In project properties(project->application->resources) there is option to choose resource file (.res) rather than "Icon and manifest" which is selected by default (This option is visible only to C# projects!).
  • For VB.Net projects this link (Also mentioned here by Waldo) can be more helpful because in my visual 2012 there is no option to select/browse Native Resource Template(.res) files but you could manually change project definition file for vb.net project as described to compile project win a native win32 resource file:

    Open your project file in notepad (*.vbProj) and add the following block:

    <PropertyGroup>
        <Win32Resource>assemblyWin32.res</Win32Resource>
    </PropertyGroup>
    

Upvotes: 0

Einar Egilsson
Einar Egilsson

Reputation: 3488

I've just created a simple tool to do exactly this without having to mess with .res files. It's a tiny utility which you can use as part of your Post-Build event and lets you add all icons 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/

Upvotes: 4

Related Questions