This is my working code for running a simple self-made .Net executable from memory :
FileStream fs = new FileStream(@"simple.exe",FileMode.Open)
The entry-point is the Main()
method or equivalent. There are multiple signatures allowed for this; you can have a parameterless Main()
, but you can also have Main(string[])
. So: you should probably check the parameters on the method
(GetParameters()
), and pass in something - presumably an empty string[]
.
Note that entry-points are generally static
; there is no need to pass in an o
, and your existing CreateInstance
code is non-sensical (it passes a method name to something that expects a type name). You can just pass null
as the first parameter.