0

I need to create a resource file for a .net project (by hand) and compile it using the ResGen.exe tool provided by the .NET framework. I can't find any documentation for this. I need to write the resource file by hand because I'm in a situation where I don't want to download/buy extra tools (like VS) to generate this resource file, and also I feel more productive through the command-line (helps me understand how things really work).

So I need to write a resource file by hand to store an ICON in the executable and use it from within my program. I would also like to use this icon to represent my executable in Windows Explorer.

Any references would be great!

Luca Matteis
  • 29,161
  • 19
  • 114
  • 169
  • This has been thoroughly answered in the following [stack overflow thread](http://stackoverflow.com/questions/2993118/how-to-perform-shell-icon-embedding-in-visual-studio-2010/10415947#10415947). We've been using this implementation and it works great. It is also open source and integrates into MSBuild. – Blake Niemyjski May 02 '12 at 14:41

3 Answers3

2

Visual C# Express Edition will do what you want for free. If nothing else you can download that, create the resource file and then use that as a subject for your admirable curiosity about 'how it really works'. This may also save you some time in manual experimentation to get it right the first time around.

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140
1

These 2 links in conjunction provide information on using that tool to create and embed an icon file, it seems specific to C#. Of course i'm guessing at your full intention, let me know if this points you in the proper direction.

http://www.xtremedotnettalk.com/showthread.php?t=75449

specifically there is a post which states; I think you should first create a *.resources-File from the Icon with the tool named "Resgen.exe"...

resgen App.ico App.ico.resources

the next step would be compiling...

csc /t:winexe /out:Keygen.exe /res:App.ico.resources /r:Crypto.dll /win32icon:App.ico Keygen.cs AssemblyInfo.cs

I'm sure you were here already. http://msdn.microsoft.com/en-us/library/ccec7sz1(VS.80).aspx

halfevil
  • 550
  • 2
  • 3
  • You use Resgen to compile a resx file and create the resource file. The question is how to embed the icon in the resx file so it can be compiled into a resource file. – pstrjds Oct 13 '10 at 18:00
1

You should check this link: http://msdn.microsoft.com/en-us/library/ekyft91f.aspx

It explains what formatter is used and gives some code samples to generate one from code. You could then write a small wrapper app that you can call from the command line. No downloads needed!

pstrjds
  • 16,840
  • 6
  • 52
  • 61