Using VS2017 RC (6th Jan 2017), I have followed the getting started instruction and created the Md5VsSha256 benchmark. When I fun I get then Dotnet restore error.
Target framework is .NetCoreApp 1.1
When I copy the code into a n assembly targeting .Net Framework 4.6.2 it works OK
Failing csproj file below
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.1" />
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>
</Project>
Although output type says exe it is really a console app. I think this is bug in VS
We don't support .NET Core for the new .csprojs. Only project.json today, but we plan to add this support.
OK. Any ETA?
Is there any chance you could post a project.json configured to target .Net Core and Framework (so I can use your config attributes)?
I've struggled quite a lot and failed so far. (Honestly, I really really don't want to criticize or come across as carping when using your tool is saving me a lot of effort, but your instructions could do with being a bit less terse. I've had to download the source and search within to find out what usings I need, for example)
@Mattacks I was planning to implement it when VS 2017 goes RTM.
Our project.json from samples should do:
{
"title": "BenchmarkDotNet.Samples",
"buildOptions": {
"emitEntryPoint": true,
"allowUnsafe": true
},
"frameworks": {
"net45": { },
"netcoreapp1.1": {
"buildOptions": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
}
}
},
"dependencies": {
"BenchmarkDotNet": "0.10.1"
}
}
Why is nothing ever easy in this world!
I created a new project (VS2015SP3)
Replaced the project.json
Went to add the benchmarkdotnet package:
PM> install-package benchmarkdotnet
Retrieving package 'BenchmarkDotNet 0.10.1' from 'nuget.org'.
Installing NuGet package BenchmarkDotNet.0.10.1.
Install failed. Rolling back...
Uninstalling NuGet package BenchmarkDotNet.0.10.1.
Executing nuget actions took 24.72 ms
Install-Package : Object reference not set to an instance of an object.At line:1 char:1
Time Elapsed: 00:00:00.6646558
Update: it was because the project.json had a typo. Have copied it from the samples source. Will see how it goes.
At last - I took the full project .json from the downloaded samples, then ported across my benchmark
{
"title": "BenchmarkDotNet.Samples",
"buildOptions": {
"emitEntryPoint": true,
"allowUnsafe": true
},
"configurations": {
"Debug": {
"buildOptions": {
"define": [ "DEBUG", "TRACE" ]
}
},
"Release": {
"buildOptions": {
"define": [ "RELEASE", "TRACE" ],
"optimize": true,
}
}
},
"frameworks": {
"net45": {
"buildOptions": {
"define": [ "CLASSIC" ]
},
"frameworkAssemblies": {
"System.Reflection": "4.0.0.0"
}
},
"netcoreapp1.1": {
"buildOptions": {
"define": [ "CORE" ]
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"System.ComponentModel.EventBasedAsync": "4.0.11"
}
}
},
"dependencies": {
"BenchmarkDotNet": "0.10.1"
}
}
@Mattacks does it mean that it works now?
btw you can use ```code``` to get nice code formatting
It does indeed (on VS 2015SP3).
Thanks.
@AndreyAkinshin @adamsitnik I really hope you guys reconsider and add support for VS2017/new csproj ASAP, rather than waiting for VS2017 to go RTM. I've just ported my package (Npgsql) to VS2017 to be able to use some important C# 7.0, and am really blocked by not being able to run benchmarks. It's true that playing catchup with Microsoft isn't easy (I do it too), but the new csproj is here to stay and packages have already started being ported.
@roji I know it, the problem is that first few previews of VS 2017 were really shitty. I just wanted to wait until it gets stable. I have spent a lot of my free time to implement dnxcore50, netcoreapp1.0, netcoreapp1.1 and netcoreapp2.0 support. I definitely want to implement it.
On Friday I am flying to Redmond, should be busy for two weeks. As soon as I find some free time I try to implement it. But I can't promise anything.
@adamsitnik thanks. I really understand, I've been riding the Microsoft prerelease train since beta6 and it's not been easy... Hopefully with the RC label VS 2017 really is nearing stability and it's worth jumping in.
Thanks for all the great work!
@roji Thanks for understanding. My ultimate goal is to use Roslyn and be independent from project types like we are today for classic .NET Framework. I tried some PoC, but so far found few blocking things. It's not that easy to mimic dotnet cli behavior and make it right ;)
Most helpful comment
@roji I know it, the problem is that first few previews of VS 2017 were really shitty. I just wanted to wait until it gets stable. I have spent a lot of my free time to implement dnxcore50, netcoreapp1.0, netcoreapp1.1 and netcoreapp2.0 support. I definitely want to implement it.
On Friday I am flying to Redmond, should be busy for two weeks. As soon as I find some free time I try to implement it. But I can't promise anything.