1

I'm trying to install BenchmarkDotNet package into a brand new, blank console project on Visual Studio 2012 ultimate and I'm getting this error log:

PM> Install-Package BenchmarkDotNet
Attempting to resolve dependency 'BenchmarkDotNet.Toolchains.Roslyn (≥ 0.10.2)'.
Attempting to resolve dependency 'BenchmarkDotNet.Core (≥ 0.10.2)'.
Attempting to resolve dependency 'System.Threading.Tasks.Extensions (≥ 4.0.0)'.
Attempting to resolve dependency 'Microsoft.CodeAnalysis.CSharp (≥ 1.3.2)'.
Attempting to resolve dependency 'Microsoft.CodeAnalysis.Common (= 1.3.2)'.
Attempting to resolve dependency 'System.Collections.Immutable (≥ 1.1.37)'.
Attempting to resolve dependency 'System.Reflection.Metadata (≥ 1.2.0)'.
Install-Package : 'System.Reflection.Metadata' already has a dependency defined for 'System.Collections.Immutable'.
At line:1 char:1
+ Install-Package BenchmarkDotNet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

BenchmarkDotNet looks so deceptively simple... But it just doesn't install for me! Has anyone got this problem, or overcome it on Visual Studio 2012?

NOTE: It did install in Visual Studio 2015 Community, but this is not a version I can use for actual development.

Loudenvier
  • 8,362
  • 6
  • 45
  • 66

2 Answers2

2

By searching on google, I just found this issue on github which is pretty similar to yours.

It seems like you won't be able to integrate BenchmarkDotNet higher than 0.9.7 on Visual Studio lower than 2015.

You should try the 0.9.7 to see if it still fits your needs.

https://github.com/dotnet/BenchmarkDotNet/issues/237

Lizi
  • 153
  • 1
  • 9
2

Short answer: you can install BenchmarkDotNet only in VisualStudio 2015+. Visual Studio 2012 uses an old version of NuGet (2.x) which doesn't support some modern packages. One of the BenchmarkDotNet dependencies is Roslyn (Microsoft.CodeAnalysis.CSharp) which requires NuGet 3.x+.

Here are related discussion about minimal supported version of Visual Studio in the BenchmarkDotNet and Roslyn repositories:

A possible workaround: you can create a new console project in VS2015/2017, install BenchmarkDotNet and copy the whole project (with the packages folder) to your computer with VS2012.

AndreyAkinshin
  • 18,603
  • 29
  • 96
  • 155