Skip to content

Instantly share code, notes, and snippets.

@dsplaisted
Last active April 29, 2019 19:45
Show Gist options
  • Save dsplaisted/b256d7804672a6f6375476a5f5658b7b to your computer and use it in GitHub Desktop.
Save dsplaisted/b256d7804672a6f6375476a5f5658b7b to your computer and use it in GitHub Desktop.
Providing Binary Logs

MSBuild Binary Logs

MSBuild has the ability to capture a detailed binary log file. If you are having a build issue and are able to provide a binary log, this will be very helpful for us to investigate the issue.

However, you should be aware of the type of information captured in the binary log to make sure you are not inadvertently sharing more than you intend. The binary log captures pretty much everything your build does, including the contents of your project files and any files (such as .props and .targets) that they import, all tasks that are run during the build as well as the input and output, as well as all environment variables. It generally won't include the contents of the source files that are compiled, but it will capture their full names and paths.

⚠ NOTE: some build environments make secrets available via environment variables. Before sharing a binary log, make sure it does not expose API tokens or other important secrets.

You can create a binary log by passing the /bl parameter to MSBuild. You can explore the contents of the generated .binlog file using MSBuild Structured Log Viewer.

@rainersigwald
Copy link

Probably worth a

⚠ NOTE: some build environments make secrets available via environment variable. Before sharing a binary log, make sure it does not expose API tokens or other important secrets.

@nguerrera
Copy link

Note that you can also pass /bl to dotnet build, which forwards extra arguments down to MSBuild.

@rainersigwald
Copy link

If you need to capture a binary log from within Visual Studio, instead of on the command line, you'll need a Visual Studio plugin: https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ProjectSystemTools

After installing that, enable logging and run your build (more details).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment