Profile Roslyn Analyzers

Dotnet Core SDK is optional, but will be used in this post.

You gonna need MSBuild  ver. >15.3 - Go to VS downloads, scroll down to Tools for Visual Studio and get Build Tools for Visual Studio 2019. Install and add msbuild.exe location to your path.

You gonna need MSBuild Binary and Structured Log Viewer.

Go to location of your project you have issue with and run

dotnet msbuild /p:ReportAnalyzer=true /bl:out.binlog /t:Clean,Build

This will produce out.binlog which you can browse with just installed log viewer.

The analysers are ran on clean build. When the project is already build (and build is not necessary), your analysers will not run during build time.

Open log file with ii *.binlog (press Tab to complete the path with Powershell).

Search for Time (s) or your analyzer assembly name.

Doing so, I've managed to find the analyzers that was causing my builds almost 2x longer.

Polish language pack just installed, gotta switch for English!

Source: Roslyn Analyzer Performance

comments powered by Disqus