mercredi 25 novembre 2015

Load/compile code from string in Mono.Cecil

I'm writing a patch using Mono.Cecil for a third-party dll to add some functionality (I see you shaking your head in disappointment at me--I am too). Right now I've got it working using an array of Instructions which I insert in the proper place and then recompile and output the dll.

This works, but right now my array is a bunch of assembly instructions. I'd rather load a .cs file as a string (or array of strings), compile it in-memory, either with Mono or .NET Reflection, load it with Mono, and replace the original method in my patched dll.

How can I do this?





Aucun commentaire:

Enregistrer un commentaire