KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.44k stars 191 forks source link

MSBuild eval items only appear on first of multi-targeting inner-builds #531

Closed AArnott closed 2 years ago

AArnott commented 3 years ago

After building a multi-targeting project, I see that only the first inner build has msbuild evaluation items presented. Log here

The outer build has items: image

The first inner build has items: image

But the second (and third) inner builds do not have items: image

KirillOsenkov commented 3 years ago

Yes, this has been fixed in newer versions of MSBuild.

For now I'd be curious if you re-run the build with -noconlog (to only have the BinaryLogger and no other loggers) - I expect this will show items on all evaluations.

The timeline of what happened is the following:

  1. https://github.com/dotnet/msbuild/pull/6287 - Log properties and items on ProjectEvaluationFinished (instead of ProjectStarted)
  2. https://github.com/dotnet/msbuild/pull/6520 - if any legacy loggers are present (such as Console logger or File loggers) revert to logging properties and items on ProjectStarted (and restore the original bug where these were logged only for the central node instead of all nodes). The situation where you only see them on some projects is because those projects ran in-proc, and MSBuild had a long-standing bug where these weren't sent across nodes.
  3. https://github.com/dotnet/msbuild/pull/6535 - Console logger support for IncludeEvaluationPropertiesAndItems - this "enlightens" the console logger to properly support the new mode, so having a console logger is no longer considered as having a "legacy logger" present.

I'm guessing that the build of MSBuild that you're using is between the steps 2 and 3 of the timeline, so we detect the console logger and turn off the new behavior, so you still get the old-standing MSBuild bug where Items are only logged for the in-proc node.

Turning off the console logger should enable the new behavior (which correctly sends Items from all nodes).

KirillOsenkov commented 2 years ago

This should be fixed in the newer SDKs. The last fixes we did that were related to this were:

https://github.com/dotnet/sdk/pull/23834 https://github.com/dotnet/sdk/pull/23249

When those are in, all should work as expected.