-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Running a benchmark fails when targeting netcoreapp2.2. That is because the *.Autogenerated.csproj. targets netcoreapp2.1 and references the original benchmark project that targets a higher netcoreapp version.
Repro:
- Create a new netcore CLI application that targets netcoreapp2.2
- Add a reference to BenchmarkDotNet v0.11.3
- Add any Benchmark w/o explicit configuration (the Md5VsSha256 example from the docs will do)
- Build the benchmark project:
dotnet build -f netcoreapp2.2 -c Release -r win-x64 --no-incremental --force
- Run the benchmark like so:
.\bin\Release\netcoreapp2.2\win-x64\Target22.exe
Expected:
The benchmark completes without errors.
Actual:
Running the benchmark (repro step 5) fails early when building the autogenerated code because the autogenerated csproj targets netcoreapp2.1 and references the original projects which targets 2.2.
Workaround:
Use an explicit configuration like so;
private class DotNetCore22Config : ManualConfig
{
public DotNetCore22Config()
{
Add(Job.Default.With(CsProjCoreToolchain.NetCoreApp22));
}
}
Let me know if you need a complete sample project to reproduce.
patricksuo