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#.
Asked
Active
Viewed 7,586 times
3
-
What kind of exe is it? Is it managed or just native? – adelphus Jan 27 '12 at 12:38
2 Answers
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
-
Thank You..!! Though I had seen that link earlier you put it in the right perspective. – arunondeck Jan 27 '12 at 12:40
-
Does it make a difference if the file being executed is a .net executable or a win32 executable? Any limitations as far as a 32 bit executable invoking a 64 bit executable? And vise versa? – MitchellKrenz Jan 27 '15 at 20:13
-