Using Embedded Resources


To compile a resource into your exe for later use:

ResourceWriter rw = new ResourceWriter("app.resources");
byte[] data = File.ReadAllBytes(scriptFile); 
rw.AddResource("script", data);
rw.Close(); 


To retrieve that resource from the exe at runtime:

ResourceManager rm = new ResourceManager("app", Assembly.GetExecutingAssembly());
byte[] data = (byte[])rm.GetObject("script"); 
UTF8Encoding encoder = new UTF8Encoding();
string text = encoder.GetString(data); 
Console.WriteLine(text);