99using System . Text ;
1010using BenchmarkDotNet . Attributes ;
1111using BenchmarkDotNet . Configs ;
12+ using BenchmarkDotNet . Jobs ;
1213using BenchmarkDotNet . Running ;
14+ using BenchmarkDotNet . Toolchains . CsProj ;
15+ using BenchmarkDotNet . Toolchains . DotNetCli ;
1316
1417namespace Microsoft . AspNetCore . BenchmarkDotNet . Runner
1518{
@@ -26,7 +29,7 @@ private static int Main(string[] args)
2629
2730 AssignConfiguration ( ref args ) ;
2831 var summaries = BenchmarkSwitcher . FromAssembly ( typeof ( Program ) . GetTypeInfo ( ) . Assembly )
29- . Run ( args , ManualConfig . CreateEmpty ( ) ) ;
32+ . Run ( args , GetConfig ( ) ) ;
3033
3134 foreach ( var summary in summaries )
3235 {
@@ -57,6 +60,24 @@ private static int Main(string[] args)
5760 return 0 ;
5861 }
5962
63+ private static IConfig GetConfig ( )
64+ {
65+ #if NET5_0 || NETCOREAPP5_0
66+ return ManualConfig . CreateEmpty ( )
67+ . AddJob ( Job . Default
68+ . WithToolchain ( CsProjCoreToolchain . From ( new NetCoreAppSettings
69+ (
70+ // not using "net5.0", a workaround for https://github.com/dotnet/BenchmarkDotNet/pull/1479
71+ targetFrameworkMoniker : "netcoreapp5.0" ,
72+ runtimeFrameworkVersion : default ,
73+ name : ".NET Core 5.0"
74+ ) ) )
75+ . AsDefault ( ) ) ;
76+ #else
77+ return ManualConfig . CreateEmpty ( ) ;
78+ #endif
79+ }
80+
6081 private static int Fail ( object o , string message )
6182 {
6283 _standardOutput ? . WriteLine ( _standardOutputText . ToString ( ) ) ;
0 commit comments