0

I have created a C# WinForm app.

I would like a single EXE file instead of

appname.exe
Resource\file1.ext
Resource\file2.ext
Resource\file3.ext

How can I embed my resources into my exe and how will my code change?

One line of code is

Help.ShowHelp(this, "Resources\\help.chm");

The other files I have are text files with values for the "About" window.

backtrack
  • 7,996
  • 5
  • 52
  • 99
Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177
  • I looked at that @PaulSasik but it's not the solution. The solution posted doesn't work. – Cocoa Dev Jul 26 '13 at 14:35
  • Help files like that are displayed by another program, hh.exe. It is ancient, written long before .NET came around and has a very primitive api. It doesn't know beans about embedded resources. It therefore requires a separate file on disk. A good way to embed such a file so you'll still have a single executable is to create a program called setup.exe, you probably know it. – Hans Passant Jul 26 '13 at 15:05
  • @CocoaDev: The answer is in there. Just include your files in the project and set file's Action property to EmbeddedResource. Rebuild and the it will get embedded. Use this method to get to the resource at runtime: http://msdn.microsoft.com/en-us/library/xc4235zt.aspx – Paul Sasik Jul 26 '13 at 15:10
  • @CocoaDev: Try this tutorial: http://support.microsoft.com/kb/319292 – Paul Sasik Jul 26 '13 at 15:31
  • @PaulSasik I am aware about the tutorial and it doesn't compile all the resources into a single EXE. It builds a resource folder. – Cocoa Dev Jul 31 '13 at 13:17
  • @CocoaDev: What you see is the project creating a resource folder. Look in your output directory and you will not see it (if you set your property to EmbeddedResource.) And to prove that the dang resource is in the assembly open it with Reflector, or DotPeek or some other assembly viewer and see for yourself. – Paul Sasik Jul 31 '13 at 13:54

0 Answers0