How to output MSBuild binary logs when using roslyn 4.9.0
or later
#71950
-
Background I'm using using var workspace = MSBuildWorkspace.Create();
var msbuildLogger = new BinaryLogger { Parameters = "msbuild.binlog" };
var project = await workspace.OpenProjectAsync("Sample.csproj", msbuildLogger);
var compilation = await project.GetCompilationAsync(); It works if you're using roslyn packages version This behavior changes are introduced at
So it seems to be intentional behavior changes. Question |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Ah yes, I didn't finalize that, did I. 😦 The challenge now is with that rewrite MSBuildWorkspace now does the builds out-of-process. This solves a huge number of problems that people have MSBuildWorkspace but it means I can't easily pass around the ILogger to the other process anymore. And I can of course have each process write out a binlog (we actually have support for that already) but you won't always have a single binlog. I've reached out to the MSBuild team to see if they have something ready-made for doing cross-process logging and merging, but if not we'll have to figure out a better plan. I'm not sure how tricky redoing that ourselves will be, so we might have to do some compromises here. As a shorter-term solution, if you're using OpenProjectAsync() then I can easily see you're passing in a BinaryLogger, and make this work. The challenge is if you're doing OpenSolutionAsync, since it's possible we might end up sending the underlying build operations to different processes, which would necessitate writing out separate binlogs for now. So @filzrev are you using solutions too or just single projects? Because I can easily make the latter work at least. Tagging @JoeRobich too since this came up in dotnet/format#2094: are you always opening a single project too? So I won't run into the multiple-buildhost problem either? |
Beta Was this translation helpful? Give feedback.
Ah yes, I didn't finalize that, did I. 😦
The challenge now is with that rewrite MSBuildWorkspace now does the builds out-of-process. This solves a huge number of problems that people have MSBuildWorkspace but it means I can't easily pass around the ILogger to the other process anymore. And I can of course have each process write out a binlog (we actually have support for that already) but you won't always have a single binlog. I've reached out to the MSBuild team to see if they have something ready-made for doing cross-process logging and merging, but if not we'll have to figure out a better plan. I'm not sure how tricky redoing that ourselves will be, so we might have to do some compromi…