public ICodeAssembly Compile(ICodeProgram program) { var compilation = RoslynCompile(program); var assembly = new ProgramAssembly { EntryPointClassName = "EntryPoint", EntryPointMethodName = "Main" }; using (var stream = new MemoryStream()) { var emitResult = compilation.Emit(stream); if (!emitResult.Success) { return null; } assembly.CompiledAssembly = stream.ToArray(); } return assembly; }
public ICodeAssembly Compile(ICodeProject program) { var compilation = RoslynCompile(program); var assembly = new ProgramAssembly { EntryPointClassName = "Script+EntryPoint", EntryPointMethodName = "Main" }; using (var stream = new MemoryStream()) { var emitResult = compilation.Emit(stream); if (!emitResult.Success) { return(null); } assembly.CompiledAssembly = stream.ToArray(); } return(assembly); }