views:

154

answers:

1

I have written a WinForms application (C# 2.0, VS2008) that registers several file types during the setup. Each file type has its own icon, but I don't want to have the .ico files in the program directory.

So I added a native resource file (.res) to my project and embedded the icons in there. This works fine, but the values in the resource file overwrite the info in AssemblyInfo.cs (like version and company).

I created the resource file in the Visual Studio designer. Is there any way to create them dynamically, so my build script can update the version info?

A: 

It's a know issue, I used to create the RC at build time and add the version info to the RC file. There is anther way which is to add the icons to the compiled exe/dll.

I found this (Command line tool with source code to add native resources to any executable) but I don't know how good it is, also I don't know if its going to break strong name singing (but you can always sign your exe/dll later again).

Shay Erlichmen
Thanks, I'll create the RC file as part of the build script and compile it into a .res file in the pre-build event.
DanielR
I tried that, but only the version number shows up - in Explorer. The company and product names are still empty. And from C#, I can't read the version number either (Application.ProductVersion returns the default 1.0.0.0 and FileVersionInfo returns empty strings).I have posted the code of my .rc file at http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/09468623-99ba-4bd9-b178-c2c3c4d52d26How did you do it?
DanielR