/// <summary> /// Executes the project and returns the console output as a string. /// </summary> /// <param name="p">The project to execute.</param> /// <returns> /// The console output. /// </returns> /// <remarks> /// Any exception that is thrown as part of the execution of the /// <see cref="Project" /> is wrapped in a <see cref="TestBuildException" />. /// </remarks> public static string ExecuteProject(Project p) { using (ConsoleCapture c = new ConsoleCapture()) { string output = null; try { p.Execute(); } catch (Exception e) { output = c.Close(); throw new TestBuildException("Error Executing Project", output, e); } finally { if (output == null) { output = c.Close(); } } return(output); } }
/// <summary> /// Executes the project and returns the console output as a string. /// </summary> /// <param name="p">The project to execute.</param> /// <returns> /// The console output. /// </returns> /// <remarks> /// Any exception that is thrown as part of the execution of the /// <see cref="Project" /> is wrapped in a <see cref="TestBuildException" />. /// </remarks> public static string ExecuteProject(Project p) { using (ConsoleCapture c = new ConsoleCapture()) { string output = null; try { p.Execute(); } catch (Exception e) { output = c.Close(); throw new TestBuildException("Error Executing Project", output, e); } finally { if(output == null) { output = c.Close(); } } return output; } }