Show / Hide Table of Contents

Class NativeAotToolchainBuilder

Inheritance
Object
CustomDotNetCliToolchainBuilder
NativeAotToolchainBuilder
Inherited Members
CustomDotNetCliToolchainBuilder.Feeds
CustomDotNetCliToolchainBuilder.runtimeIdentifier
CustomDotNetCliToolchainBuilder.customDotNetCliPath
CustomDotNetCliToolchainBuilder.displayName
CustomDotNetCliToolchainBuilder.runtimeFrameworkVersion
CustomDotNetCliToolchainBuilder.useNuGetClearTag
CustomDotNetCliToolchainBuilder.useTempFolderForRestore
CustomDotNetCliToolchainBuilder.AdditionalNuGetFeed(String, String)
CustomDotNetCliToolchainBuilder.UseNuGetClearTag(Boolean)
CustomDotNetCliToolchainBuilder.TargetFrameworkMoniker(String)
CustomDotNetCliToolchainBuilder.GetTargetFrameworkMoniker()
CustomDotNetCliToolchainBuilder.DotNetCli(String)
CustomDotNetCliToolchainBuilder.RuntimeIdentifier(String)
CustomDotNetCliToolchainBuilder.RuntimeFrameworkVersion(String)
CustomDotNetCliToolchainBuilder.DisplayName(String)
CustomDotNetCliToolchainBuilder.UseTempFolderForRestore(Boolean)
Namespace: BenchmarkDotNet.Toolchains.NativeAot
Assembly: BenchmarkDotNet.dll
Syntax
public class NativeAotToolchainBuilder : CustomDotNetCliToolchainBuilder

Methods

Create()

Declaration
public static NativeAotToolchainBuilder Create()
Returns
Type Description
NativeAotToolchainBuilder

IlcGenerateCompleteTypeMetadata(Boolean)

This controls the generation of complete type metadata. This option is enabled by default. This is a compilation mode that prevents a situation where some members of a type are visible to reflection at runtime, but others aren't, because they weren't compiled.

Declaration
public NativeAotToolchainBuilder IlcGenerateCompleteTypeMetadata(bool value)
Parameters
Type Name Description
Boolean value
Returns
Type Description
NativeAotToolchainBuilder

IlcGenerateStackTraceData(Boolean)

This controls generation of stack trace metadata that provides textual names in stack traces. This option is enabled by default. This is for example the text string one gets by calling Exception.ToString() on a caught exception. With this option disabled, stack traces will still be generated, but will be based on reflection metadata alone (they might be less complete).

Declaration
public NativeAotToolchainBuilder IlcGenerateStackTraceData(bool value)
Parameters
Type Name Description
Boolean value
Returns
Type Description
NativeAotToolchainBuilder

IlcInstructionSet(String)

By default, the compiler targets the minimum instruction set supported by the target OS and architecture. This option allows targeting newer instruction sets for better performance. The native binary will require the instruction sets to be supported by the hardware in order to run. For example, avx2,bmi2,fma,pclmul,popcnt,aes will produce binary that takes advantage of instruction sets that are typically present on current Intel and AMD processors.

Declaration
public NativeAotToolchainBuilder IlcInstructionSet(string value)
Parameters
Type Name Description
String value

Specify empty string ("", not null) to use the defaults.

Returns
Type Description
NativeAotToolchainBuilder

IlcOptimizationPreference(String)

Options related to code generation.

Declaration
public NativeAotToolchainBuilder IlcOptimizationPreference(string value = "Speed")
Parameters
Type Name Description
String value

"Speed" to favor code execution speed (default), "Size" to favor smaller code size

Returns
Type Description
NativeAotToolchainBuilder

PackagesRestorePath(String)

The directory to restore packages to (optional).

Declaration
public NativeAotToolchainBuilder PackagesRestorePath(string packagesRestorePath)
Parameters
Type Name Description
String packagesRestorePath
Returns
Type Description
NativeAotToolchainBuilder

RootAllApplicationAssemblies(Boolean)

This controls the compiler behavior where all code in the application assemblies is considered dynamically reachable. This option is disabled by default. Enabling this option (true) has a significant effect on the size of the resulting executable because it prevents removal of unused code that would otherwise happen.

Declaration
public NativeAotToolchainBuilder RootAllApplicationAssemblies(bool value)
Parameters
Type Name Description
Boolean value
Returns
Type Description
NativeAotToolchainBuilder

ToToolchain()

Declaration
public override IToolchain ToToolchain()
Returns
Type Description
IToolchain
Overrides
CustomDotNetCliToolchainBuilder.ToToolchain()

UseLocalBuild(DirectoryInfo)

creates a NativeAOT toolchain targeting local build of ILCompiler Based on https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md

Declaration
public NativeAotToolchainBuilder UseLocalBuild(DirectoryInfo ilcPackages)
Parameters
Type Name Description
DirectoryInfo ilcPackages

the path to shipping packages, example: "C:\runtime\artifacts\packages\Release\Shipping"

Returns
Type Description
NativeAotToolchainBuilder

UseNuGet(String, String)

creates a NativeAOT toolchain targeting NuGet build of Microsoft.DotNet.ILCompiler Based on https://github.com/dotnet/runtimelab/blob/d0a37893a67c125f9b0cd8671846ff7d867df241/samples/HelloWorld/README.md#add-corert-to-your-project

Declaration
public NativeAotToolchainBuilder UseNuGet(string microsoftDotNetILCompilerVersion = "7.0.0-*", string nuGetFeedUrl = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json")
Parameters
Type Name Description
String microsoftDotNetILCompilerVersion

the version of Microsoft.DotNet.ILCompiler which should be used. The default is: "7.0.0-*"

String nuGetFeedUrl

url to NuGet feed, The default is: "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json"

Returns
Type Description
NativeAotToolchainBuilder
In This Article
Back to top Copyright © 2013–2021 .NET Foundation and contributors