[Mono-dev] Looking to programmatically build assembly with Mono.CSharp

Miguel de Icaza miguel at xamarin.com
Sat May 31 01:34:29 UTC 2014


It is not hard to do.

It will take someone a couple of hours to figure out what needs to be
exposed.

In addition, I just realized something important.   Mono.CSharp is compiled
with the System.Reflection.Emit backend which has several problems, you are
better off compiling your own Mono.CSharp.Batch for example that uses the
IKVM.Reflection backend (which is what the mcs.exe batch compiler uses).

Miguel


On Fri, May 30, 2014 at 9:31 PM, Brandon Perry <bperry.volatile at gmail.com>
wrote:

> Oh, not a problem at all. I currently invoke the compiler via Process, but
> was hoping to get away from that.
>
> Thanks for the quick response. :)
>
>
> On Fri, May 30, 2014 at 8:30 PM, Miguel de Icaza <miguel at xamarin.com>
> wrote:
>
>> Hello,
>>
>> The interface surfaced by Mono.CSharp does not provide what you want.
>>
>> It is designed to generate code for runtime evaluation.
>>
>> You could hack the existing source code to achieve something similar, it
>> is not too hard, but it was never a priority.
>>
>> Miguel
>>
>>
>> On Fri, May 30, 2014 at 7:03 PM, Brandon Perry <bperry.volatile at gmail.com
>> > wrote:
>>
>>> Hi,
>>>
>>> Looking to do something similar to this blog post here, but with
>>> Mono.CSharp, and not Microsoft's CSharp. I haven't found any documentation
>>> on this specifically, but there are posts about interpreting C# at runtime
>>> via repl.
>>>
>>>
>>> http://blogs.msdn.com/b/dohollan/archive/2010/08/09/programmatically-invoke-the-c-compiler.aspx
>>>
>>> Anyone have a small code example? I would prefer to not have to write
>>> the code to the file system if possible, Just pass a string of code and
>>> have it result in a byte array of the assembly that I can then write to the
>>> FS.
>>>
>>> Thanks in advance for any thoughts!
>>>
>>> --
>>> http://volatile-minds.blogspot.com -- blog
>>> http://www.volatileminds.net -- website
>>>
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>>>
>>
>
>
> --
> http://volatile-minds.blogspot.com -- blog
> http://www.volatileminds.net -- website
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140530/9fff389f/attachment-0001.html>


More information about the Mono-devel-list mailing list