[Mono-dev] C# scripting
Jonathan Pryor
jonpryor at vt.edu
Wed May 6 13:51:34 EDT 2009
On Tue, 2009-05-05 at 11:27 -0700, bradvin wrote:
> I read a cool article the other day where the author says that it is possible
> to dynamically compile C# code at runtime using mono:
See: http://tirania.org/blog/archive/2008/Sep-10.html. That page is
somewhat out of date -- you now compile with -r:Mono.CSharp.dll instead
of referencing gmcs.exe, and the method names have changed -- but the
basics are still the same.
See also the Mono.CSharp documentation at:
http://www.go-mono.com/docs/index.aspx?tlink=18@N%3aMono.CSharp
The documentation has an example at:
http://www.go-mono.com/docs/index.aspx?link=M%3aMono.CSharp.Evaluator.Evaluate(System.String)
> Does anyone know how to reference MONO and use the Mono.CSharp namespace
> from within a .NET c# project?
Sadly, this isn't possible, as Mono.CSharp requires use of mono's
runtime, not the .NET runtime. There is ongoing work to remove this
restriction, but I don't know when it will be complete. Work is part of
the "Replace all SRE-based compilers with the new compiler" currently
targeted for Mono 2.8; see:
http://www.mono-project.com/Roadmap
> I tried other scripting tools and they did what I wanted but as soon as I
> tried them in medium trust, they fell apart.
Even after the SRE removal is complete, I'm not sure that this will work
in medium trust. (I'm also not sure what's involved in making things
work in medium trust.) I also find it surprising that the DLR-based
languages like IronPython and IronRuby don't support medium trust; is
this really so?
- Jon
More information about the Mono-devel-list
mailing list