I'm using mono for an embedded scripting environment in my application. For the compilation of the scripts I use Microsoft.CSharp.CSharpCodeProvider. Now I require some 4.0 or 4.5 Functionality like System.Numerics. However, referencing the System.Numerics.dll in the compiler options just gets me the error
(0,0) : error CS0006: Metadata file `System.Numerics.dll' could not be found
Since the assembly location of the provider points to the 2.0.0.0 gac I'm not too surprised to see this fail. However, with mono-2.11.4 and the v4.0 and v4.5 profiles in place I wonder why the provider does not find the required assemblies or if it even provides v4.0 as requested.
var provider_options = new Dictionary<string,string>();
provider_options.Add("CompilerVersion", "v4.0");
CodeDomProvider provider = new CSharpCodeProvider(provider_options);
CompilerParameters cparams = new CompilerParameters ();
cparams.GenerateExecutable = true;
cparams.OutputAssembly = Path.ChangeExtension(rFileNames[0],".exe");
cparams.ReferencedAssemblies.Add( "System.dll" );
cparams.ReferencedAssemblies.Add( "System.Windows.Forms.dll" );
cparams.ReferencedAssemblies.Add( "System.Drawing.dll" );
cparams.ReferencedAssemblies.Add( "Mono.Debugger.Soft.dll" );
cparams.ReferencedAssemblies.Add( "System.Numerics.dll" );