Skip to content

[Breaking change]: NativeAOT CLI command handling enabled by default (DOTNET_CLI_ENABLEAOT) #54650

Description

@baronfel

Description

Starting in .NET 11 Preview 7, the .NET SDK CLI enables its NativeAOT-compiled command-handling fast path by default on all platforms. This path is controlled by the DOTNET_CLI_ENABLEAOT environment variable, whose default changes from disabled to enabled. Common dotnet invocations (command-line parsing, --version, --info, and a growing set of built-in/external commands) are handled by a native entry point that transparently falls back to the managed CLI for anything it does not handle.

Note

During development this change initially shipped enabled on Windows only, because a command-line parsing crash (dotnet/command-line-api#2812) blocked the native path on macOS and Linux. That crash has since been fixed upstream (dotnet/command-line-api#2820) and flowed into the SDK, so the fast path is now enabled by default on all platforms.

Version

.NET 11 Preview 7

Previous behavior

The NativeAOT CLI fast path was off by default on all platforms. Unless DOTNET_CLI_ENABLEAOT was explicitly set to a truthy value (true/1/yes/on), every dotnet invocation was handled by the managed CLI.

New behavior

The NativeAOT CLI fast path is on by default on all platforms (Windows, macOS, and Linux). Supported commands are handled natively; anything unsupported transparently falls back to the managed CLI. Users can opt out and route every invocation to the managed CLI by setting DOTNET_CLI_ENABLEAOT to a falsy value: false, 0, no, or off.

Type of breaking change

  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

Now that the native command-handling path has reached parity with the managed CLI, enabling it by default provides broad real-world testing and improves CLI startup performance for common commands.

Recommended action

The native path is designed to be behaviorally identical to the managed CLI and should require no action. If you observe a difference in behavior, set the environment variable DOTNET_CLI_ENABLEAOT=false (or 0/no/off) to opt out and route all invocations to the managed CLI, and please report the difference at https://github.com/dotnet/sdk/issues.

Feature area

SDK

Affected APIs

None (CLI behavior; no managed API surface change).


Tracking issue: dotnet/sdk#55078
Environment variable reference documentation: #54648 (PRs #54649, #54735)

SDK pull request: dotnet/sdk#55144

The macOS/Linux blocker (dotnet/command-line-api#2812) was fixed by: dotnet/command-line-api#2820

The DOTNET_CLI_ENABLEAOT opt-out is documented at:
https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_cli_enableaot


Associated WorkItem - 594987

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions