internal static int Run(string[] args) { CompilerFatalError.Handler = FailFast.OnFatalException; Csc compiler = new Csc(CSharpResponseFileName, Directory.GetCurrentDirectory(), args); // We store original encoding and restore it later to revert // the changes that might be done by /utf8output options // NOTE: original encoding may not be restored if process terminated Encoding origEncoding = Console.OutputEncoding; try { if (compiler.Arguments.Utf8Output && Console.IsOutputRedirected) { Console.OutputEncoding = Encoding.UTF8; } return compiler.Run(Console.Out); } finally { try { Console.OutputEncoding = origEncoding; } catch { // Try to reset the output encoding, ignore if we can't } } }
internal static int Run(string[] args) { CompilerFatalError.Handler = FailFast.OnFatalException; Csc compiler = new Csc(CSharpResponseFileName, Directory.GetCurrentDirectory(), args); // We store original encoding and restore it later to revert // the changes that might be done by /utf8output options // NOTE: original encoding may not be restored if process terminated Encoding origEncoding = Console.OutputEncoding; try { if (compiler.Arguments.Utf8Output && Console.IsOutputRedirected) { Console.OutputEncoding = Encoding.UTF8; } return(compiler.Run(Console.Out)); } finally { try { Console.OutputEncoding = origEncoding; } catch { // Try to reset the output encoding, ignore if we can't } } }
static int Main(string[] args) { return(Csc.Run(args)); }