Skip to content

Commit 83c6acf

Browse files
committed
Changed default toolchain for .Net Framework to CsProjClassicNetToolchain.
1 parent 0a41e16 commit 83c6acf

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

src/BenchmarkDotNet/Toolchains/CsProj/CsProjClassicNetToolchain.cs

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
namespace BenchmarkDotNet.Toolchains.CsProj
1010
{
11-
/// <summary>
12-
/// this toolchain is designed for the new .csprojs, to build .NET 4.x benchmarks from the context of .NET Core host process
13-
/// it does not work with the old .csprojs or project.json!
14-
/// </summary>
1511
[PublicAPI]
1612
public class CsProjClassicNetToolchain : Toolchain
1713
{

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)