# What's New in the .NET 11 CLI

> The .NET 11 CLI starts faster, manages solution filters, splits file-based apps across files, and gives dotnet test a serious upgrade. Here are the changes worth knowing about.

- URL: https://blog.nimblepros.com/blogs/dotnet-11-cli-updates/
- Author: [Barret Blake](https://blog.nimblepros.com/authors/barretblake/)
- Published: 2026-11-19
- Categories: [Software Development](https://blog.nimblepros.com/categories/software-development/)
- Publisher: [NimblePros](https://blog.nimblepros.com/)

---

.NET 11 shipped last week, and most of the attention goes to the runtime, C# 15, and ASP.NET Core. But the `dotnet` CLI deserves a look too. It's the tool behind everyday builds, test runs, and migrations. You'll find our other .NET 11 coverage [at the end of this post](#more-net-11-on-the-blog).

Every build, every test run, every `dotnet ef` migration goes through it. In .NET 11, the CLI got a lot of love: it starts faster, it handles a few chores that used to mean hand-editing files, and `dotnet test` picked up a stack of features that CI pipelines will appreciate.

Let's walk through the changes worth knowing about.

## It Starts Faster. A Lot Faster.

The biggest change is one you'll feel without doing anything. The `dotnet` host is now compiled with Native AOT and is on by default. Commands that don't need the managed runtime run natively:

- `dotnet --version`, `dotnet --info`, and `dotnet --help`
- `dotnet <command> --help` for every built-in command
- `dotnet sln list`, `dotnet sln migrate`, and `dotnet sln remove`

More importantly, tool and external-command invocations now launch straight from the AOT host. That skips the 600 to 700 ms of managed CLI startup that used to sit in front of commands like `dotnet ef` and `dotnet dev-certs`. If you run `dotnet ef migrations add` a dozen times a day, that adds up.

The MSBuild server is also enabled by default now. It keeps a warm MSBuild worker around between invocations, so repeated `dotnet build` and `dotnet test` calls skip some of the startup overhead.

If either one causes trouble in your environment, you can turn it off:

```bash
# Opt out of the Native AOT CLI host
export DOTNET_CLI_ENABLEAOT=false

# Opt out of the MSBuild server
export DOTNET_CLI_USE_MSBUILD_SERVER=false
```

## Solution Filters From the Command Line

Solution filters (`.slnf` files) let you load or build a subset of a large solution without changing the solution itself. They've been around for years, but the CLI couldn't create or edit them, so you either used Visual Studio or wrote the JSON by hand.

In .NET 11, `dotnet sln` handles them just like solutions:

```bash
dotnet new slnf --parent-solution MySolution.slnx --name Tests
dotnet sln Tests.slnf add tests/Tests/Tests.csproj
dotnet sln Tests.slnf list
dotnet sln Tests.slnf remove tests/Tests/Tests.csproj
```

This works with the newer `.slnx` format too. For big repos, that means a CI job can build just the projects it needs, and a script can generate a filter for a team without anyone opening an IDE.

## File-Based Apps Grow Up

File-based apps arrived in .NET 10 and let you run a `.cs` file with `dotnet run app.cs`, no project file needed. They're great for scripts and quick experiments. SDK 10.0.300 added the `#:include` directive for splitting source across files, and .NET 11 builds on that workflow.

Here's how source-file inclusion works:

```csharp
#!/usr/bin/env dotnet
#:include helpers.cs
#:include models/customer.cs

Console.WriteLine(Helpers.FormatOutput(new Customer()));
```

Included C# files can declare types, methods, and namespaces, but cannot contain top-level statements. Keep those in the entry-point file.

In .NET 11, you can also include a prebuilt DLL, which gets treated as a reference:

```csharp
#:include ./libs/MyLibrary.dll
```

Included files can declare their own `#:package`, `#:property`, and `#:sdk` directives. Duplicates are fine as long as the values match, so a shared helper file can bring along its own dependencies.

A few other improvements round this out:

- `#:property` values can be quoted, so values with spaces work: `#:property AssemblyTitle="My Script"`.
- `#:package`, `#:project`, and `#:ref` accept trailing `Name=Value` item metadata, such as `#:package System.CommandLine@2.0.1 Aliases=CommandLine`.
- `dotnet reference add --file app.cs ../MyLib/MyLib.csproj` adds a `#:project` directive for you, and `dotnet reference list` and `remove` work on file-based apps too.
- `dotnet format app.cs` formats a file-based app.
- Unchanged file-based apps reuse their cached build output, so a second `dotnet app.cs` starts quickly.

One small heads-up: when I tried this, the SDK flagged my test file with analyzer warning `CA2266`, which wants a file-based program's entry point to start with a `#!` shebang line. Add `#!/usr/bin/env dotnet` at the top and the warning goes away. As a bonus, you can then make the file executable and run it directly on Linux and macOS.

## `dotnet run` Quality-of-Life Fixes

### An existing shortcut worth remembering: `-e`

Although it predates .NET 11, `dotnet run -e` is worth remembering alongside these updates. Added in SDK 9.0.200, it passes environment variables to your app right on the command line:

```bash
dotnet run -e ASPNETCORE_ENVIRONMENT=Development -e LOG_LEVEL=Debug
```

No more exporting shell variables you'll forget to clean up, or adding a launch profile just to flip one setting. And since the syntax is the same in every shell, the command works as written whether you're in Bash, PowerShell, or `cmd`.

### MSBuild properties in launch profiles

A launch profile's `commandLineArgs` can now reference MSBuild properties. A value like `--name $(AssemblyName)` gets expanded with the project's actual assembly name when you run `dotnet run --launch-profile <profile>`.

### Cleaner standard output

The "Using launch settings from..." message now goes to `stderr` instead of `stdout`. If you have scripts that capture the output of `dotnet run`, you no longer need to strip that line out.

## `dotnet test` Gets a Big Upgrade

`dotnet test` running on Microsoft Testing Platform (MTP) got the longest list of changes in this release. Here are the ones I expect to use most.

The examples in this section require test projects configured to use MTP. For an existing MTP-compatible suite, select the runner in your shell before running them:

```bash
export DOTNET_TEST_RUNNER=Microsoft.Testing.Platform
```

This .NET 11 setting overrides the runner selection in `global.json` for the current shell session. It doesn't convert VSTest-based projects to MTP; migrate those projects first. See the [MTP introduction](https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-intro) for setup guidance.

### Run-level limits

You can now put limits on the whole run, not just on each test app:

```bash
# Limit time with at least one test app running to 90 seconds
dotnet test --timeout 90s

# Stop after five failed, errored, timed-out, or cancelled results
dotnet test --maximum-failed-tests 5
```

The timeout counts only while at least one test application is running, so it is not a wall-clock limit on the entire command, including build time. Both limits apply across the run. Keep these options before any `--` separator; options after it are forwarded to individual test applications.

These return distinct exit codes (3 for a timeout, 13 for the failure limit), so your CI pipeline can tell "the tests failed" apart from "the tests hung." The failure limit is especially nice for a big suite where one broken dependency causes hundreds of failures. You find out in seconds instead of waiting for the whole run to finish.

### Better progress and cancellation

In an interactive terminal, the progress area now shows which tests are running right now. When a run seems stuck, you can see exactly which test is holding things up.

Ctrl+C now works in two stages. The first press stops starting new test apps and lets the current ones finish. A second press kills everything.

### Traversal projects and other additions

`dotnet test` now understands `Microsoft.Build.Traversal` projects, so `dotnet test dirs.proj` works in repos that use them. A few other additions:

- `--no-dependencies` skips building project references, like it already did for `dotnet build`.
- `--results-directory-layout per-module` gives each test app its own output folder, so reports with the same file name stop overwriting each other.
- The `DOTNET_TEST_RUNNER` environment variable switches between `VSTest` and `Microsoft.Testing.Platform` without editing `global.json`.
- `--nologo` now hides the test platform banner.

### xUnit v3 templates

The built-in `xunit` template can now create an xUnit v3 project that uses Microsoft Testing Platform by default:

```bash
dotnet new xunit --xunit-version v3
```

### Affected tests (experimental)

There's also an experimental option to run only the tests affected by a change. It depends on a separate MTP extension and is behind a feature flag, so I'd treat it as something to try, not something to rely on yet:

```bash
export DOTNET_CLI_ENABLE_AFFECTED_TESTS=1
dotnet test --collect-test-map
dotnet test --affected-tests
```

## `dotnet watch` Improvements

`dotnet watch` picked up a few changes for those long development sessions:

- **Aspire integration.** It now works with Aspire app hosts, so hot reload covers your whole Aspire app.
- **Crash recovery.** If your app crashes, `dotnet watch` restarts it on your next file change instead of sitting there waiting for you to notice.
- **Device selection.** For MAUI and mobile projects, `dotnet watch --device <device-id>` picks the target device. Without it, you get an interactive picker when more than one device is available.

A handful of long-standing annoyances are fixed as well, including browser refresh for static server-rendered pages in Blazor Web apps and Ctrl+C handling for Windows Forms and WPF apps.

## Supply Chain Protection With Package Age Limits

This one is small but timely. NuGet sources can now have a minimum publish age, and you can set it from the CLI:

```bash
dotnet nuget add source https://api.nuget.org/v3/index.json --name public --min-publish-age-hours 24 --configfile nuget.config
```

When `dotnet package add` or `dotnet package update` picks a version for you, it skips any version newer than the configured age. If you ask for a specific version, the CLI uses it and skips the age check.

A waiting period gives the ecosystem time to detect suspicious releases, adding another layer of protection.

## Smaller Things Worth Knowing

There's a long tail of smaller changes. A few that stood out:

- `dotnet reference add` and `remove` now default to the project in the current directory, like `dotnet reference list` always has.
- The `Configuration` environment variable now sets the default for `-c`/`--configuration` across commands. An explicit option still wins.
- `dotnet tool exec` and `dnx` no longer ask for an extra approval before running a tool.
- Concurrent `dotnet tool install`, `update`, and `uninstall` calls no longer interfere with each other.
- `dotnet format` only looks for `.editorconfig` files above the files it's actually formatting, so it no longer wanders through `node_modules`. It also accepts `--framework` for multi-targeted projects.
- Container publishing can build multi-arch images with Podman, and setting `SOURCE_DATE_EPOCH` gives you reproducible image digests.
- On Linux and macOS, the SDK install is roughly 18 to 26 percent smaller, depending on the package format, thanks to replacing duplicate files with symbolic links.
- CLI telemetry now uses OpenTelemetry instead of Application Insights. What's collected hasn't changed, and `DOTNET_CLI_TELEMETRY_OPTOUT` still turns it off.

## Wrapping Up

None of these changes will make headlines on their own, but together they make the CLI noticeably nicer to use every day. Faster startup helps every command you run. Solution filter support replaces hand-edited JSON. File-based apps gain DLL inclusion and CLI reference management alongside the source-file inclusion introduced in SDK 10.0.300. And the `dotnet test` changes give CI pipelines better ways to fail fast and report clearly.

Once you've installed the .NET 11 SDK, start with the easy wins: create a solution filter, add a `--maximum-failed-tests` limit to an MTP-based CI test step, and notice how much faster `dotnet ef` starts up.

## More .NET 11 on the Blog

### Tiles & Tokens

In the [Tiles & Tokens series](../../series/tiles-and-tokens/), Sadukie builds a board game with .NET 11 and C# 15 from start to finish:

- [Rolling Into .NET 11: Modeling a Board Game with C# 15](../rolling-into-dotnet-11-modeling-a-board-game-with-csharp-15/)
- [Discriminated Unions in C# 15: A Turn Is Exactly One Thing](../discriminated-unions-in-csharp-15-a-turn-is-exactly-one-thing/)
- [Closed Hierarchies in C# 15: Every Victory Condition Accounted For](../closed-hierarchies-in-csharp-15-every-victory-condition-accounted-for/)
- [Saving the Game: System.Text.Json and Union State](../saving-the-game-system-text-json-and-union-state/)
- [EF Core 11: Querying Deeply Nested Game State Without Schema Friction](../ef-core-11-querying-deeply-nested-game-state/)
- [The Bonus Round: Publishing Tiles & Tokens with Native AOT](../the-bonus-round-publishing-tiles-and-tokens-with-native-aot/)

### C#, EF Core, and ASP.NET Core

- [The Rest of C# 15: The Smaller Features Worth Knowing](../csharp-15-smaller-features/)
- [EF Core 11 Part I: Migrations Get Friendlier for Teams](../ef-core-11-migrations/)
- [EF Core 11 Part II: Faster Queries and SQL Server Upgrades](../ef-core-11-performance-sql-server/)
- [Async Validation in ASP.NET Core 11](../async-validation-aspnet-core-11/)

## Resources

- [What's New in the SDK and Tooling for .NET 11](https://learn.microsoft.com/dotnet/core/whats-new/dotnet-11/sdk)
- [File-Based Apps](https://learn.microsoft.com/dotnet/core/sdk/file-based-apps)
- [dotnet run](https://learn.microsoft.com/dotnet/core/tools/dotnet-run)
- [Microsoft Testing Platform Overview](https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-intro)
- [Minimum Package Publish Age](https://learn.microsoft.com/nuget/consume-packages/minimum-package-publish-age)
- [Download .NET 11](https://dotnet.microsoft.com/download/dotnet/11.0)
