6

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?

James
  • 1,973
  • 1
  • 18
  • 32

1 Answers1

8

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

Kyle B
  • 2,328
  • 1
  • 23
  • 39
heavyd
  • 17,303
  • 5
  • 56
  • 74
  • Does MSBuild expose an API for start a build which it threads internally or does managing a thread to handle building seperate from the application at large need to be done by the application? – James Oct 22 '10 at 20:43
  • @James I suggest you create a new question here on the site to get your answer if it hasn't already been asked. – heavyd Oct 22 '11 at 04:08
  • Hey @James could you tell me something about the asynchronous API? – Joel May 16 '13 at 16:49