public BuildRunResults RunBuild(Project project, string buildExecutable) { var timer = Stopwatch.StartNew(); _buildExecutable = buildExecutable; var properties = buildProperties(project); var arguments = string.Format("\"{0}\"", project.Key) + properties; DebugLog.Debug.WriteMessage(string.Format("Running build: {0} {1}", _buildExecutable, arguments)); Process process = new Process(); process.StartInfo = new ProcessStartInfo(_buildExecutable, arguments); process.StartInfo.RedirectStandardOutput = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); string line; var buildResults = new BuildRunResults(project.Key); var lines = new List<string>(); while ((line = process.StandardOutput.ReadLine()) != null) lines.Add(line); process.WaitForExit(); timer.Stop(); var parser = new MSBuildOutputParser(buildResults, lines.ToArray()); parser.Parse(); buildResults.SetTimeSpent(timer.Elapsed); return buildResults; }
public BuildRunResults RunBuild(string projectName, string buildExecutable) { var timer = Stopwatch.StartNew(); _buildExecutable = buildExecutable; var outputDir = getOutputDir(); Process process = new Process(); process.StartInfo = new ProcessStartInfo(_buildExecutable, string.Format("\"{0}\"", projectName) + " /property:OutDir=" + outputDir); process.StartInfo.RedirectStandardOutput = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); string line; var buildResults = new BuildRunResults(projectName); var lines = new List<string>(); while ((line = process.StandardOutput.ReadLine()) != null) lines.Add(line); process.WaitForExit(); timer.Stop(); var parser = new MSBuildOutputParser(buildResults, lines.ToArray()); parser.Parse(); buildResults.SetTimeSpent(timer.Elapsed); return buildResults; }
private static BuildRunResults runBuild(string buildExecutable, string arguments, string target, Func<bool> abortIfTrue) { var timer = Stopwatch.StartNew(); DebugLog.Debug.WriteInfo("Running build: {0} {1}", buildExecutable, arguments); Process process = new Process(); process.StartInfo = new ProcessStartInfo(buildExecutable, arguments); process.StartInfo.RedirectStandardOutput = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); string line; var buildResults = new BuildRunResults(target); var lines = new List<string>(); while ((line = process.StandardOutput.ReadLine()) != null) { if (abortIfTrue.Invoke()) { process.Kill(); process.WaitForExit(); AutoTest.Core.DebugLog.Debug.WriteDebug("Aborting build run"); return new BuildRunResults(target); } lines.Add(line); } process.WaitForExit(); timer.Stop(); var parser = new MSBuildOutputParser(buildResults, lines.ToArray()); parser.Parse(); buildResults.SetTimeSpent(timer.Elapsed); return buildResults; }