public void Build(string[] extraClasspaths, bool debugMode, bool noPreBuild, bool noPostBuild) { Console.WriteLine("Building " + project.Name); BuildEventRunner runner = new BuildEventRunner(project, compilerPath); bool attempedPostBuildEvent = false; try { if (!noPreBuild && project.PreBuildEvent.Length > 0) { Console.WriteLine("Running Pre-Build Command Line..."); runner.Run(project.PreBuildEvent, debugMode); } if (project.OutputType == OutputType.Application) { DoBuild(extraClasspaths, debugMode); } attempedPostBuildEvent = true; if (!noPostBuild && project.PostBuildEvent.Length > 0) { Console.WriteLine("Running Post-Build Command Line..."); runner.Run(project.PostBuildEvent, debugMode); } } finally { // honor the post-build request on a failed build if you want if (!attempedPostBuildEvent && project.AlwaysRunPostBuild && project.PostBuildEvent.Length > 0) { Console.WriteLine("Running Post-Build Command Line..."); runner.Run(project.PostBuildEvent, debugMode); } } Console.WriteLine("Build succeeded"); }
public void Build(string[] extraClasspaths, bool debugMode, bool noPreBuild, bool noPostBuild) { Console.WriteLine("Building " + project.Name); BuildEventRunner runner = new BuildEventRunner(project, compilerPath); bool attempedPostBuildEvent = false; try { if (!noPreBuild && project.PreBuildEvent.Length > 0) { Console.WriteLine("Running Pre-Build Command Line..."); runner.Run(project.PreBuildEvent, debugMode); } if (project.OutputType == OutputType.Application) DoBuild(extraClasspaths, debugMode); attempedPostBuildEvent = true; if (!noPostBuild && project.PostBuildEvent.Length > 0) { Console.WriteLine("Running Post-Build Command Line..."); runner.Run(project.PostBuildEvent, debugMode); } } finally { // honor the post-build request on a failed build if you want if (!attempedPostBuildEvent && project.AlwaysRunPostBuild && project.PostBuildEvent.Length > 0) { Console.WriteLine("Running Post-Build Command Line..."); runner.Run(project.PostBuildEvent, debugMode); } } Console.WriteLine("Build succeeded"); }