We changed building https://github.com/aspnet repos from file logger to using binary logger recently
I am trying to replay a binary log generated by our build to a text file, but I am hitting the following issue
C:\github\testing\artifacts\msbuild [dev]> dotnet msbuild .\msbuild.binlog /noconlog /flp:verbosity=diag`;logfile=diag.log
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: .\msbuild.binlog
For switch syntax, type "MSBuild /help"
dotnet --info
.NET Command Line Tools (2.0.0-preview2-006080)
Product Information:
Version: 2.0.0-preview2-006080
Commit SHA-1 hash: 0a89053574
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Users\kichalla\.dotnet\x64\sdk\2.0.0-preview2-006080\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview2-25309-07
Build : 41f5fc94eedc889f086800c23f35bf14a8c75a9f
Attached COREHOST_TRACE based log file
output.txt
Attached the binary log file that I was trying with (rename file extension from .zip to .log)
msbuild.zip
When you do this, what's the way to find out the full path to MSBuild.exe being called and the exact command line arguments passed to it?
To be able to debug I need to replicate the invocation of MSBuild and I need to know which .exe to tall, which working directory and which command line arguments to pass.
Unfortunately the output.txt doesn't seem to mention any of these. Generally it'd be super useful if output.txt printed these out before calling MSBuild.
Based on the following text in output.txt file:
Launch host: C:\Users\kichalla\.dotnet\x64\dotnet.exe, app: C:\Users\kichalla\.dotnet\x64\sdk\2.0.0-preview2-006080\MSBuild.dll, argc: 6, args: /m,/v:m,.\msb
uild.binlog,/noconlog,/flp:verbosity=diag;logfile=diag.log,/Logger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Users\kichalla\.dotnet\x64\sdk\2.0.0-preview2-006080\dotnet.dll,
you can try the following command which reproduces the above error:
C:\Users\kichalla\.dotnet\x64\dotnet.exe C:\Users\kichalla\.dotnet\x64\sdk\2.0.0-preview2-006080\MSBuild.dll /m /v:m .\msbuild.binlog /noconlog /flp:verbosity=diag;logfile=diag.log /Logger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Users\kichalla\.dotnet\x64\sdk\2.0.0-preview2-006080\dotnet.dll
Ah, so this is bypassing MSBuild.exe? MSBuild.exe has logic to understand the /bl switch:
http://source.dot.net/#MSBuild/XMake.cs,601
I didn't do any changes to dotnet, this only adds it to MSBuild.exe.
@KirillOsenkov dotnet.exe msbuild.dll is a direct invocation of MSBuild, just like mono MSBuild.exe is. Looks like something's broken in the .NET Core implementation of project detection, maybe.
Oh! msbuild.dll is the "entrypoint", I saw the "dll" and thought that's Microsoft.Build.dll... hmm then I'm not sure how that works. I've never thought about it but we probably need to update dotnet.exe if we want it to be available cross-plat?
The problem is that there's an msbuild.rsp file next to the log when we output it (the response file we used to invoke MSBuild). MSBuild sees this and thinks it's an automatic-response file and concatentates each line into the commandline.
If you add /noautoresponse it should work.
You get the same error if you have a Foo.csproj with an msbuild.rsp next to it containing the following and try to build Foo.csproj:
Bar.csproj
Thanks @anurse ...it worked!
Closing this since it wasn't really MSBuild's fault, but filed #2121 to improve the error message to make this sort of thing easier to diagnose in the future.
Most helpful comment
The problem is that there's an
msbuild.rspfile next to the log when we output it (the response file we used to invoke MSBuild). MSBuild sees this and thinks it's an automatic-response file and concatentates each line into the commandline.If you add
/noautoresponseit should work.You get the same error if you have a
Foo.csprojwith anmsbuild.rspnext to it containing the following and try to buildFoo.csproj: