Table of Contents

Class DotNetCliGenerator

Namespace
BenchmarkDotNet.Toolchains.DotNetCli
Assembly
BenchmarkDotNet.dll
public abstract class DotNetCliGenerator : GeneratorBase, IGenerator
Inheritance
DotNetCliGenerator
Implements
Derived
Inherited Members

Constructors

DotNetCliGenerator(string, string, string, bool)

protected DotNetCliGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, bool isNetCore)

Parameters

targetFrameworkMoniker string
cliPath string
packagesPath string
isNetCore bool

Properties

CliPath

public string CliPath { get; }

Property Value

string

IsNetCore

protected bool IsNetCore { get; }

Property Value

bool

PackagesPath

public string PackagesPath { get; }

Property Value

string

TargetFrameworkMoniker

public string TargetFrameworkMoniker { get; }

Property Value

string

Methods

CopyAllRequiredFiles(ArtifactsPaths)

if you need to copy some extra files to make the benchmarks work you should override this method

protected override void CopyAllRequiredFiles(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

GenerateBuildScript(BuildPartition, ArtifactsPaths)

generates a script can be used when debugging compilation issues

protected override void GenerateBuildScript(BuildPartition buildPartition, ArtifactsPaths artifactsPaths)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths

GetArtifactsToCleanup(ArtifactsPaths)

returns a list of artifacts that should be removed after running the benchmarks

protected override string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths)

Parameters

artifactsPaths ArtifactsPaths

Returns

string[]

GetBuildArtifactsDirectoryPath(BuildPartition, string)

we need our folder to be on the same level as the project that we want to reference we are limited by xprojs (by default compiles all .cs files in all subfolders, Program.cs could be doubled and fail the build) and also by NuGet internal implementation like looking for global.json file in parent folders

protected override string GetBuildArtifactsDirectoryPath(BuildPartition buildPartition, string programName)

Parameters

buildPartition BuildPartition
programName string

Returns

string

GetExecutableExtension()

returns OS-specific executable extension

protected override string GetExecutableExtension()

Returns

string

GetPackagesDirectoryPath(string)

returns a path to the folder where NuGet packages should be restored

protected override string GetPackagesDirectoryPath(string buildArtifactsDirectoryPath)

Parameters

buildArtifactsDirectoryPath string

Returns

string