3

Plainly put, I have added as a resource to a visual studio project an exe file. How do I run this file? I'm coding in c#.

arunondeck
  • 368
  • 6
  • 16

2 Answers2

6

You can take Resource as byte[]

byte[] myResBytes = ...;
Assembly asm = Assembly.Load(myResBytes);
// search for the Entry Point
MethodInfo method = asm.EntryPoint;
if(method == null) throw new NotSupportedException();
// create an instance of the Startup form Main method
object o = asm.CreateInstance(method.Name);
// invoke the application starting point
method.Invoke(o, null);

Also see here for more details

Hope this helps

Arsen Mkrtchyan
  • 49,896
  • 32
  • 148
  • 184
0

You must use Process.Start method. See it in msdn

Vitaly Zemlyansky
  • 331
  • 1
  • 3
  • 12