Executing MSIL dynamically

R

Roy V

I have succesfully been able to use ILDASM.exe to disassemble a dll
into MSIL instructions. I would like to store this MSIL in a text
field in SQL Server and then call it up in a .NET application for
execution. How is this done? I have looked at Reflection.Emit, but
it seems that you have to generate IL code and then run it, I already
have the MSIL code, I just want to run it.

Thanks for any help,

Roy
 
J

Jop Pascual

Haven't tried this myself (yet), but have a look at the Assembly class.
It has Load method that expects a byte[]. You can pass in your
IL in there and see if that does the job.

Of course, that only loads the IL/assembly. You then use reflection
to call on the assembly's entrypoint.

Cheers!
 
G

Günter Prossliner

You could launch ILASM using Process.Start, and then load the compiled
Assembly via Reflection. Ok?

GP
 
R

Roy V

Thanks for all the help. Calling ILASM.exe should do the trick,
hopefully my boss will like it. Thanks again.

Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top