Skip to content

Template has hardcoded netcoreapp3.0 TFM #1512

@am11

Description

@am11

Using dotnet 5.0 preview 8, the template produces netcoreapp3.0 hardcoded csproj:

$ dotnet new --version
5.0.100-preview.8.20362.3

$ dotnet new --install BenchmarkDotNet.Templates::0.12.1
$ dotnet new benchmark --console-app -n MathBenchmarks
$ cd MathBenchmarks
$ head -3 MathBenchmarks.csproj

outputs:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>

running it with dotnet run gives:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
  - The following frameworks were found:
      5.0.0-preview.8.20361.2 at [/Users/am11/.dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.0.0&arch=x64&rid=osx.10.14-x64

running after fixing csproj by hand, by replacing netcoreapp3.0 with net5.0, results in the following exception:

Unhandled exception. System.NotSupportedException: Unknown .NET Runtime
   at BenchmarkDotNet.Portability.RuntimeInformation.GetCurrentRuntime()
   at BenchmarkDotNet.Characteristics.Resolver.<>c__DisplayClass1_0`1.<Register>b__0(CharacteristicObject obj)
   at BenchmarkDotNet.Characteristics.Resolver.Resolve[T](CharacteristicObject obj, Characteristic`1 characteristic)
   at BenchmarkDotNet.Characteristics.CompositeResolver.Resolve[T](CharacteristicObject obj, Characteristic`1 characteristic)
   at BenchmarkDotNet.Characteristics.CharacteristicObject.ResolveValue[T](Characteristic`1 characteristic, IResolver resolver)
   at BenchmarkDotNet.Toolchains.ToolchainExtensions.GetToolchain(Job job, Descriptor descriptor)
   at BenchmarkDotNet.Toolchains.ToolchainExtensions.GetToolchain(BenchmarkCase benchmarkCase)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.<>c__DisplayClass12_0.<GetSupportedBenchmarks>b__2(BenchmarkCase benchmark)
   at System.Linq.Enumerable.WhereArrayIterator`1.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.<>c__DisplayClass12_0.<GetSupportedBenchmarks>b__0(BenchmarkRunInfo info)
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.GetSupportedBenchmarks(BenchmarkRunInfo[] benchmarkRunInfos, ILogger logger, IResolver resolver)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithDirtyAssemblyResolveHelper(Type type, IConfig config)
   at BenchmarkDotNet.Running.BenchmarkRunner.<>c__DisplayClass0_0`1.<Run>b__0()
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithExceptionHandling(Func`1 run)
   at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig config)
   at MathBenchmarks.Program.Main(String[] args) in /Users/am11/projects/MathBenchmarks/Program.cs:line 9

In addition to net5.0 support; ideally, BDN's template (like many other templates available on nuget) should use the latest TFM supported by executing dotnet process (3.1 or 5.0, instead of fixed 3.0).

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions