Benchmarkdotnet: No way to set RuntimeFrameworkVersion in multiple-version config

Created on 30 Aug 2017  路  6Comments  路  Source: dotnet/BenchmarkDotNet

I'm interested in comparing disassembly from specific preview drops of .NET Core against each other and .NET Core 2.0, so I tried using a config like this:

```c#
public class MyConfig : ManualConfig
{
public MyConfig()
{
// RyuJit for .NET Core 2.0
Add(Job.ShortRun.With(Jit.RyuJit).With(Platform.X64).With(Runtime.Core).With(CsProjCoreToolchain.NetCoreApp20));
// RyuJit for .NET Core 2.1
Add(Job.ShortRun.With(Jit.RyuJit).With(Platform.X64).With(Runtime.Core).With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp2.1", "2.1.0-preview2-25628-01", ".NET Core 2.1"))));

        Add(DisassemblyDiagnoser.Create(new DisassemblyDiagnoserConfig(printAsm: true, recursiveDepth: 2)));
    }
}
Then when running the benchmark, I see this:

[Host] : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
Job-XQOYPV : .NET Core 2.0.0 (Framework 4.6.00001.0), 64bit RyuJIT
Job-XHPTDD : .NET Core 2.1.0-preview2-25616-02 (Framework 4.6.00001.0), 64bit RyuJIT
```

Job-XHPTDD ran on a different preview build of NET Core 2.1 than what I requested (I have both installed).

It seems the MicrosoftNETCoreAppVersion set on the NetCoreAppSettings object isn't actually used in the .NET Core csproj toolchain; what I'd need is a <RuntimeFrameworkVersion>2.1.0-preview2-25628-01</RuntimeFrameworkVersion> element inserted in the generated csproj, but I can't seem to find an extensibility point that would make it easy for me to add one.

That element does get copied over from the found csproj to the generated csproj in GetSettingsThatNeedsToBeCopied, and if I put it in my csproj and target the csproj against 2.1, then the 2.1 run does indeed work with the desired version, but I can't do the cross-version comparison runs.

It would be great to have an easy way to target specific versions. (Or, if I'm just overlooking one, then it would be great to have a more easily discoverable way :) )

Toolchains

Most helpful comment

Hi @JosephTremoulet

I have just pushed the fix. The two fields of NetCoreAppSettings that were previously used to generate project.json got now removed. I just forgot to remove them after project.json abandon.

I have added new property, called RuntimeFrameworkVersion which generates the right thing.

You should be able to try it in 30 minutes when this build finishes.

Please let me know if it works now.

All 6 comments

Hi @JosephTremoulet

I have just pushed the fix. The two fields of NetCoreAppSettings that were previously used to generate project.json got now removed. I just forgot to remove them after project.json abandon.

I have added new property, called RuntimeFrameworkVersion which generates the right thing.

You should be able to try it in 30 minutes when this build finishes.

Please let me know if it works now.

@adamsitnik, thanks for the quick fix. Could you also update the docs and describe the new property? It can be useful for other people who try to work with different .NET Core versions.

@adamsitnik, yes, it works just like I'd hoped, thanks!

@AndreyAkinshin I added the docs for toolchains, link

@adamsitnik, awesome, thanks!
I guess it makes sense to release v0.10.10 on the next week.

I guess it makes sense to release v0.10.10 on the next week.

Good idea!

Was this page helpful?
0 / 5 - 0 ratings