I have small problem with my .net 2.0 winforms application.
I want to embed a few different icons to app.
There are also other requirements:
- must be automatic rebuildable by
ms-build; using external gui apps
for preparation isn't allowed - application must contain versioninfo.
After embeding multiple icons, I want to register let's say two file associations to application documents / extension files.
[Registry]
...
Root: HKCR; Subkey: "MyFileExt\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MyApp.exe,2"
where "2" it's icon index.
I know that I need to use somehow old-style Win32 resource file.
I also found somewhere that if using Visual Studio 2005 it's possible to add 'native resource file' but it doesn't exist in 2008 anymore.
Is it possible to meet all this requirements and if yes – how?
Best Solution
The solution is actually quite simple, although it required that I think back to my first encounter with RC files...
In a plain text file, you can write the following
(Details about the VERSIONINFO structure can be found in MSDN:
VERSIONINFO
structure)You compile using
rc
, which should either be part of VS, or in the Windows Platform SDK. The result of the compilation of your.rc
file is a.res
file which can be included in the properties page of your C# project -- or add the following in the.csproj
file itself.Compile your project and look in the explorer, the info and icons should be there.
The CSC compiler also provides a
/win32res
switch that embeds the.res
file into you app.Hope this helps!