I'm relatively new to Mono and I am trying to add C# scripting capabilities to my application. I found this blog post by Miguel de Icaza. The way to call the C# compiler as a service is to include Mono.CSharp and use the Evaluator class, specifically the Evaluate or Run methods. This is documented here.
So here is my example code (derived from the other blog posts on the internet on this subject, yes I've done my googling)
using System;
using Mono.CSharp;
namespace EvalTest
{
public class Test
{
static void Main(string [] args)
{
Mono.CSharp.Evaluator.Evaluate("using System;");
Mono.CSharp.Evaluator.Run("using System;");
}
}
}
And when we try to compile it I get these errors:
eval.cs(10,19): error CS0234: The type or namespace name `Evaluator' does not exist in the namespace `Mono.CSharp'. Are you missing an assembly reference?
eval.cs(11,19): error CS0234: The type or namespace name `Evaluator' does not exist in the namespace `Mono.CSharp'. Are you missing an assembly reference?
The same thing happens on Linux and OSX using all the Mono compilers, I even tried the silverlight one. I have searched stackoverflow for similar questions, everyone references Miguel's blog post and some similar sample code. What am I missing? Is there some compiler flag I need to add? Thanks for your help.