Skip to content

Commit 077e4f3

Browse files
committed
Changed default toolchain for .Net Framework to CsProjClassicNetToolchain.
Removed check in test.
1 parent e6fdc6b commit 077e4f3

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/BenchmarkDotNet/Toolchains/ToolchainExtensions.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ internal static IToolchain GetToolchain(this Runtime runtime, Descriptor? descri
3636
{
3737
case ClrRuntime clrRuntime:
3838
if (!preferMsBuildToolchains && RuntimeInformation.IsFullFramework
39-
&& RuntimeInformation.GetCurrentRuntime().MsBuildMoniker == runtime.MsBuildMoniker)
39+
&& RuntimeInformation.GetCurrentRuntime().MsBuildMoniker == runtime.MsBuildMoniker
40+
// If dotnet SDK is installed, we use CsProjClassicNetToolchain.
41+
&& (!HostEnvironmentInfo.GetCurrent().IsDotNetCliInstalled()
42+
// Integration tests take too much time, because each benchmark run rebuilds the test suite and BenchmarkDotNet itself.
43+
// To reduce the total duration of the CI workflows, we just use RoslynToolchain.
44+
|| XUnitHelper.IsIntegrationTest.Value))
4045
{
4146
return RoslynToolchain.Instance;
4247
}

tests/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks/MultipleFrameworksTest.cs

-14
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ public class MultipleFrameworksTest : BenchmarkTestExecutor
2222
[InlineData(RuntimeMoniker.Net80)]
2323
public void EachFrameworkIsRebuilt(RuntimeMoniker runtime)
2424
{
25-
#if NET461
26-
// We cannot detect what target framework version the host was compiled for on full Framework,
27-
// which causes the RoslynToolchain to be used instead of CsProjClassicNetToolchain when the host is full Framework
28-
// (because full Framework always uses the version that's installed on the machine, unlike Core),
29-
// which means if the machine has net48 installed (not net481), the net461 host with net48 runtime moniker
30-
// will not be recompiled, causing the test to fail.
31-
32-
// If we ever change the default toolchain to CsProjClassicNetToolchain instead of RoslynToolchain, we can remove this check.
33-
if (runtime == RuntimeMoniker.Net48)
34-
{
35-
// XUnit doesn't provide Assert.Skip API yet.
36-
return;
37-
}
38-
#endif
3925
var config = ManualConfig.CreateEmpty().AddJob(Job.Dry.WithRuntime(runtime.GetRuntime()).WithEnvironmentVariable(TfmEnvVarName, runtime.ToString()));
4026
CanExecute<ValuePerTfm>(config);
4127
}

0 commit comments

Comments
 (0)