使用 MSBuild 4.0 记录构建消息
我在代码中使用 MsBuild 4.0,如下所示:
var globalProperties = new Dictionary<string, string>();
var buildRequest = new BuildRequestData(solutionPathAbsolute, globalProperties, null, new string[] { "Build" }, null);
var pc = new ProjectCollection();
var result = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), buildRequest);
请注意此 API 与 MsBuild 3.5 完全不同...记录器中的一个钩子如何使用新 API 接收详细的构建消息?
I am using MsBuild 4.0 in code, like so:
var globalProperties = new Dictionary<string, string>();
var buildRequest = new BuildRequestData(solutionPathAbsolute, globalProperties, null, new string[] { "Build" }, null);
var pc = new ProjectCollection();
var result = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), buildRequest);
Note how this API is completely different from MsBuild 3.5... How does one hook in a logger to recieve detailed build messages with the new API?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BeginBuild 方法允许您传入一组 BuildParameters 其中包含 Loggers 属性。
The BeginBuild method on the BuildManager allows you to pass in a set of BuildParameters which includes a Loggers property.