Skip to content

Can't benchmark library that targets 'net5.0-windows' framework #1535

@jonstelly

Description

@jonstelly

I've got a library that has some WPF components so its target framework is net5.0-windows. So my unit tests / benchmark project also has to target net5.0-windows. I'm trying to run benchmarkdotnet from xUnit using:

[SimpleJob(RuntimeMoniker.NetCoreApp50)]
[SimpleJob(RuntimeMoniker.CoreRt50)]
public class BitmapBenchmarks
{
    [Benchmark]
    public void FindVisibleMarker()
    {
        //My benchmark test stuff here...
    }
}

[Fact]
public void BitmapBenchmarks()
{
    var summary = BenchmarkRunner.Run<BitmapBenchmarks>();
    Logger.Information("Results: ...", summary...);
}

and I'm getting this error:

error NU1201: Project MyThing.Tests is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Project MyThing.Tests supports: net5.0-windows7.0 (.NETCoreApp,Version=v5.0)

I can't change the benchmark project to net5.0 because the underlying library targets net5.0-windows. Is there some way to run these benchmarks against the net50-windows framework?

I know net50 is still in preview, so I'll completely understand if this just isn't supported yet.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions