dotnet / BenchmarkDotNet

Powerful .NET library for benchmarking
https://benchmarkdotnet.org
MIT License
10.48k stars 963 forks source link

BenchmarkDotNet.Autogenerated.csproj is not working on .NET Core 2.1 #816

Closed heavenwing closed 6 years ago

heavenwing commented 6 years ago

I clone this project : https://github.com/bleroy/core-imaging-playground After set TargetFramework to netcoreapp2.1 and upgrade nuget to latest version. I try to run benchmark , got below error:

// Build Exception:   Restoring packages for E:\Source\MyGitHub\core-imaging-playground\NetCore\bin\Release\netcoreapp2.1\5a3f8bdb-3ed1-4c9d-b326-c5d17fda7a1d\BenchmarkDotNet.Autogenerated.csproj...
E:\Source\MyGitHub\core-imaging-playground\NetCore\bin\Release\netcoreapp2.1\5a3f8bdb-3ed1-4c9d-b326-c5d17fda7a1d\BenchmarkDotNet.Autogenerated.csproj : error NU1201: Project NetCore is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Project NetCore supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1)
  Generating MSBuild file E:\Source\MyGitHub\core-imaging-playground\NetCore\bin\Release\netcoreapp2.1\5a3f8bdb-3ed1-4c9d-b326-c5d17fda7a1d\obj\BenchmarkDotNet.Autogenerated.csproj.nuget.g.props.
  Generating MSBuild file E:\Source\MyGitHub\core-imaging-playground\NetCore\bin\Release\netcoreapp2.1\5a3f8bdb-3ed1-4c9d-b326-c5d17fda7a1d\obj\BenchmarkDotNet.Autogenerated.csproj.nuget.g.targets.
  Restore failed in 1.06 sec for E:\Source\MyGitHub\core-imaging-playground\NetCore\bin\Release\netcoreapp2.1\5a3f8bdb-3ed1-4c9d-b326-c5d17fda7a1d\BenchmarkDotNet.Autogenerated.csproj.

I attach BenchmarkDotNet.Artifacts here: BenchmarkDotNet.Artifacts.zip

My .NET Core installed is

PS E:\Source\MyGitHub\core-imaging-playground\NetCore> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
adamsitnik commented 6 years ago

Hi @heavenwing

The default .NET Core for 0.10.14 of BenchmarkDotNet is .NET Core 1.1

To get it working you need to tell BDN which .NET Core to use:

BenchmarkRunner.Run<Program>(
    DefaultConfig.Instance
        .With(Job.Default.With(CsProjCoreToolchain.NetCoreApp21)));

Our master branch has already fix for that, it will be released as 0.11.0 within 1-2 weeks.

heavenwing commented 6 years ago

Thanks