/// <summary> /// When overridden in a derived class, executes the task. /// </summary> /// <returns> /// true if the task successfully executed; otherwise, false. /// </returns> public override bool Execute() { try { // Get arguments var args = GenerateArguments(); if (null == args) { // If we get no result, the derived class should have set the log messages. return(false); } else { if (0 == args.Length) { // If we get no parameters, we don't need to call the compiler. return(true); } else { // Show arguments (low level) var builder = new CommandLineBuilder(); foreach (var arg in args) { if (arg.StartsWith("--")) { builder.AppendSwitch(arg); } else { builder.AppendFileNameIfNotNull(arg); } } Log.LogCommandLine(MessageImportance.Normal, builder.ToString()); // Invoke return(CompilerService.Execute(args, Log)); } } } catch (AggregateException agex) { foreach (var ex in agex.Flatten().InnerExceptions) { ErrorLog.DumpError(ex); Log.LogErrorFromException(ex); } return(false); } catch (Exception ex) { ErrorLog.DumpError(ex); Log.LogErrorFromException(ex); return(false); } }