Table of Contents

Class CsProjGenerator

Namespace
BenchmarkDotNet.Toolchains.CsProj
Assembly
BenchmarkDotNet.dll
public class CsProjGenerator : DotNetCliGenerator, IGenerator, IEquatable<CsProjGenerator>
Inheritance
CsProjGenerator
Implements
Derived
Inherited Members

Constructors

CsProjGenerator(string, string, string, string, bool)

public CsProjGenerator(string targetFrameworkMoniker, string cliPath, string packagesPath, string runtimeFrameworkVersion, bool isNetCore = true)

Parameters

targetFrameworkMoniker string
cliPath string
packagesPath string
runtimeFrameworkVersion string
isNetCore bool

Properties

RuntimeFrameworkVersion

public string RuntimeFrameworkVersion { get; }

Property Value

string

Methods

Equals(CsProjGenerator)

public bool Equals(CsProjGenerator other)

Parameters

other CsProjGenerator

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GenerateProject(BuildPartition, ArtifactsPaths, ILogger)

generates .csproj file with a reference to the project with benchmarks

protected override void GenerateProject(BuildPartition buildPartition, ArtifactsPaths artifactsPaths, ILogger logger)

Parameters

buildPartition BuildPartition
artifactsPaths ArtifactsPaths
logger ILogger

GetBinariesDirectoryPath(string, string)

returns a path where executable should be found after the build (usually \bin)

protected override string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)

Parameters

buildArtifactsDirectoryPath string
configuration string

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

GetHashCode()

public override int GetHashCode()

Returns

int

GetIntermediateDirectoryPath(string, string)

returns a path where intermediate files should be found after the build (usually \obj)

protected override string GetIntermediateDirectoryPath(string buildArtifactsDirectoryPath, string configuration)

Parameters

buildArtifactsDirectoryPath string
configuration string

Returns

string

GetProjectFilePath(string)

returns a path to the auto-generated .csproj file

protected override string GetProjectFilePath(string buildArtifactsDirectoryPath)

Parameters

buildArtifactsDirectoryPath string

Returns

string

GetProjectFilePath(Type, ILogger)

returns a path to the project file which defines the benchmarks

protected virtual FileInfo GetProjectFilePath(Type benchmarkTarget, ILogger logger)

Parameters

benchmarkTarget Type
logger ILogger

Returns

FileInfo

GetRuntimeSettings(GcMode, IResolver)

returns an MSBuild string that defines Runtime settings

protected virtual string GetRuntimeSettings(GcMode gcMode, IResolver resolver)

Parameters

gcMode GcMode
resolver IResolver

Returns

string