Based on answers which I see - it seems to be quite trivial, but unfortunately it's not so simple.
Let's start from .rc file - you can quickly write file like this:
myown.rc:
1 ICON "..\\Folder1\\icon1.ico"
2 ICON "..\\folder2\\icon2.ico"
1 24 "myown.manifest"
But next question - where to get manifest file which you need for your application.
It's possible to extract currently used manifest file, using command line like this:
mt -inputresource:myOwnNetExe.exe;#1 -out:myown.manifest
And then you can use that manifest with your .net executable.
But this is not all.
From project itself you cannot specify relative path to your .res file, you can use only absolute path. Save .csproj, and edit it manually with notepad - to make path relative. Project compiles just fine after that.
But into svn / git - you probably won't put .res file - only source code.
Need to compile .rc to .res.
Best to do it in project / pre-build step.
But of course rc.exe cannot be launched, since it's C++ project, and we have C# project which does not care about C++ project pathes.
This can be walkarounded using pre-build step like this:
cd $(ProjectDir)
call "%VS100COMNTOOLS%\vsvars32.bat" >nul
rc /c 1252 /nologo myown.rc
Where you need to change VS100COMNTOOLS with visual studio with which you're compiling (I'm using Visual studio 2010).
And this is still not everything. If you want to change icon of your application on fly - in run-time - you might be interested in code snipet like this:
[DllImport("shell32.dll")]
public static extern IntPtr ExtractIcon(IntPtr hInst, string file, int nIconIndex);
[DllImport("user32.dll", SetLastError = true)]
static extern bool DestroyIcon(IntPtr hIcon);
/// <summary>
/// Sets icon from .exe or .dll into form object
/// </summary>
/// <param name="iIconIndex">Icon index to use.</param>
/// <param name="form">Form to assign to given icon</param>
/// <returns>true if ok, false if failed.</returns>
bool SetIcon( object form, int iIconIndex, String dllOrExe = null )
{
if( dllOrExe == null )
dllOrExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
IntPtr hIcon = ExtractIcon(IntPtr.Zero, dllOrExe, iIconIndex);
if( hIcon == IntPtr.Zero )
return false;
Icon icon = (Icon) Icon.FromHandle(hIcon).Clone();
DestroyIcon(hIcon);
form.GetType().GetProperty("Icon").SetValue(form, icon);
return true;
}
Where in form_load you can place call like this:
SetIcon(this, N);
Where N = 0 for first icon, N = 1 - for second and so on.
18.5.2016 Update My approach works ok - however - after this assembly file properties - version information disappears. It's possible to restore it back using typical C++ .rc file, but unfortunately for me it does then break assembly attributes somehow - task manager will display your exe as "Application". I've tried to harvest bit deeper if it's possible to somehow alter manifest / application title - but without any result. After that I've ended up using InsertIcons.exe solution proposed here as well.
So if you're not interested in file version information - you can use my solution, if you need file version and task manager should show your application correctly - use InsertIcons.exe. C# code snipet (SetIcon) here will work for you in any solution whatsoever.