我想通过代码运行 MSBUILD,并在构建过程中获取构建的异步状态(类似于 TeamCity 或任何其他构建运行程序)。
我正在使用以下代码:
var projectFileName = @"...\MyApplication\MyApplication.sln";
ProjectCollection pc = new ProjectCollection();
var GlobalProperty = new Dictionary<string, string>();
GlobalProperty.Add("Configuration", "Debug");
GlobalProperty.Add("Platform", "x86");
var buildRequest = new BuildRequestData(projectFileName, GlobalProperty, null, new string[] { "Build" }, null);
var buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), buildRequest);
有没有办法通过代码获取当前正在执行的 MSBUILD 任务?