Running BenchmarkDotNet benchmarks against .NET 7

.NET 7 will be released in November 2022. If you want to run performance benchmarks against it using BenchmarkDotNet you need to get BenchmarkDotNet via the nightly builds. At the time of writing the released version on NuGet is 0.13.1 and doesn’t support .NET 7.

The nightly builds are easy to pull in via NuGet, you just have to add a new source URL into your NuGet Packages sources configuration. This can be easily done through Visual Studio Tools -> Options -> NuGet Package Manger -> Package Sources screen as shown below…

The name is bdn-nightly
The Source URL is https://ci.appveyor.com/nuget/benchmarkdotnet

Next you need to download the latest stable version of BenchmarkDotNet which as of now is 0.13.1.1806. You can do this by right clicking on your project and selecting ‘Manage NuGet Packages…’ and then selecting bdn-nightly as your Package source in the top right of the screen as highlighted below…

After installing version 0.13.1.1806 (or greater) and assuming you have the .NET 7 SDK installed and your project targets net7.0 like below you should now be able to run BenchmarkDotNet benchmarks on .NET 7


Sample output is below…

Leave a Reply

Your email address will not be published.