public static Assembly compile(this string pathToFileToCompile, bool generateDebugSymbols) { PublicDI.CurrentScript = pathToFileToCompile; var csharpCompiler = new CSharp_FastCompiler(); csharpCompiler.generateDebugSymbols= generateDebugSymbols; var compileProcess = new System.Threading.AutoResetEvent(false); csharpCompiler.compileSourceCode(pathToFileToCompile.contents()); csharpCompiler.onCompileFail = () => compileProcess.Set(); csharpCompiler.onCompileOK = () => compileProcess.Set(); compileProcess.WaitOne(); return csharpCompiler.assembly(); }
public static Assembly compile_CodeSnippet(this string codeSnipptet, bool generateDebugSymbols) { //Note we can't use the precompiled engines here since there is an issue of the resolution of this code dependencies var csharpCompiler = new CSharp_FastCompiler(); csharpCompiler.generateDebugSymbols= generateDebugSymbols; var compileProcess = new System.Threading.AutoResetEvent(false); //csharpCompiler.compileSourceCode(pathToFileToCompile.contents()); csharpCompiler.compileSnippet(codeSnipptet); csharpCompiler.onCompileFail = () => compileProcess.Set(); csharpCompiler.onCompileOK = () => compileProcess.Set(); compileProcess.WaitOne(); var assembly = csharpCompiler.assembly(); return assembly; }