Skip to content

Capturing Binary Logs

Jonathan Dick edited this page Feb 14, 2024 · 3 revisions

It is often extremely helpful to attach "binary logs" to an issue which you have collected from your project. These binary logs (also known as a binlog) contain useful build output information in a format which is much easier to analyze with a tool such as MSBuild Binary and Structure Log Viewer.

If you are asked to provide these types of logs, you should also consider if it's more appropriate to capture them from a command line build (which is preferred, if you are able to reproduce your issue that way), or from Visual Studio (if you're unable to produce the same issues from a command line build).

Here are the steps for either scenario:

Binary Logs from CLI / Command Line

Any dotnet build command can have the -bl flag appended to the command to capture the output to a .binlog file which by default is called msbuild.binlog and is created in your current working directory where you issued the build command from. More binary log into and command options can be found in the MSBuild Binary Log Docs.

eg: dotnet build MauiApp1.csproj -bl

Binary Logs from Visual Studio

  1. Under Visual Studio's Tools > Options, in the Projects and Solutions > Build And Run section, ensure that MSBuild project build log file verbosity is set to Diagnostic image

  2. In Visual Studio's Extensions > Manage Extensions... Browse for, and install Project System Tools 2022 image

You will need to close Visual Studio and finish installing the extension before using it

  1. In Visual Studio's View > Other Windows > Build Logging, click the "Play" button to start recording build logs: image

  2. Run the step(s) / build command(s) to reproduce your issue - you should see a number of entries start to appear in the Build Logging pane. image

  3. Select all of the entries, and right click and select Save Logs... which will prompt you to select a folder to save them to.

  4. Create a zip archive of the logs which were exported and attach those to your issue