Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging Build messages with MSBuild 4.0

Tags:

c#

msbuild-4.0

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?

like image 973
James Avatar asked Oct 21 '10 17:10

James


1 Answers

The BeginBuild method on the BuildManager allows you to pass in a set of BuildParameters which includes a Loggers property.

like image 149
heavyd Avatar answered Sep 19 '22 17:09

heavyd