using System; using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.CSharp; using System.Text; using System.IO; using System.Reflection; namespace CompiledDll {/ **
Cp.GenerateExecutable = false; cp.generateInMemory = false; cp.outputassembly = outfilename; streamreader file = file.opentext (@filename); string code = file.readToeend (); file.close ();
CompilerResults cr = comp.compileAssemblyfromsource (CP, CODE);
IF (cr.erroilder error = new stringbuilder (); error.Append ("ERROR Compiling Expression:"); Foreach (CompileRerror Err IN CR.Error) {Error.Appendformat ("{0}", ERR . ErrText);} throw new exception ("Error Compiling Expression:" Error.Tostring ());} else {return true;}}}}