loading experience

.NET

.NET 11 SDK and CLI tooling: everything new and how to upgrade

What's new in the .NET 11 SDK: .slnf filters, file-based apps with #:include, dotnet run -e, dotnet watch, dotnet test, NativeAOT CLI and how to upgrade.

The .NET 11 SDK brings smaller installers, refined analyzers, a much more convenient CLI and important changes for testing, containers, MSBuild and NuGet. This article summarizes the official page and ends with instructions for upgrading your SDK.

SDK footprint

On Linux and macOS, duplicate assemblies (.dll and .exe files with the same hash) are replaced with symbolic links to a single copy, for tarballs, .pkg, .deb and .rpm. According to the source, an early build had 35% of the SDK directory duplicated; on linux-x64 the tarball goes from 230 to 189 MB (-17.8%), the deb from 164 to 122 MB (-25.6%), the rpm from 165 to 122 MB (-26.0%), and containers save 8-17%. Crossgen is also skipped for assemblies that exist only under DotnetTools/, saving another 23.6 MB. Windows deduplication is not included.

Analyzers and warnings

  • CA1873 (potentially expensive logging) has fewer false positives: property accesses, GetType(), GetHashCode() and GetTimestamp() are no longer flagged, and by default only Information level and below is checked. The message now states the reason (method invocation, object or array creation, boxing, string interpolation, collection expression, anonymous object, await, with expression).
  • Fixes: CA1515 and CA1034 no longer misfire with C# extension members; CA1859 handles default interface implementations; AnalysisLevel=latest wrongly used .NET 9 rules and now uses .NET 11 rules.
  • NETSDK1235: a warning when a project with PackAsTool=true sets a custom NuspecFile; packing still proceeds.

Command-line productivity

  • Solution filters: dotnet new slnf --parent-solution MySolution.slnx --name Tests, then dotnet sln Tests.slnf add|list|remove.
  • File-based apps across files: the #:include directive (also for DLLs, mapped to Reference items, with no feature flag); #:sdk, #:property and #:package may appear duplicated across included files when the values match. #:property accepts quoted values; #:package, #:project and #:ref accept trailing Name=Value metadata tokens (for example Aliases=CommandLine). A : is no longer allowed in property names.
  • Native AOT for file-based apps: dotnet run --file app.cs, dotnet run app.cs and dotnet app.cs can reuse existing build outputs; dotnet format app.cs works; with the artifacts layout, outputs go to the repository's artifacts folder.
  • dotnet run -e: dotnet run -e ASPNETCORE_ENVIRONMENT=Development -e LOG_LEVEL=Debug passes environment variables, visible to MSBuild as RuntimeEnvironmentVariable items; MSBuild properties in launch-profile commandLineArgs are expanded; the "Using launch settings from..." notice goes to stderr.
  • dotnet watch: Aspire app host integration, automatic relaunch after a crash, better Ctrl+C for Windows Forms and WPF, device selection for MAUI and mobile (dotnet watch --device <device-id>), browser refresh for static SSR pages in Blazor Web apps, and several long-standing bugs fixed. iOS Simulator projects need <MtouchLink>None</MtouchLink>.
  • dotnet reference: add and remove fall back to the current directory without --project and support file-based apps (dotnet reference add --file app.cs).
  • More: static fish shell completions; dotnet format limits .editorconfig discovery to included files (one benchmark went from 1.09 to 0.55 seconds) and accepts --framework; dotnet test in MTP mode supports --artifacts-path; dotnet tool exec and dnx no longer ask for an extra approval; dotnet new install --prerelease; the Configuration environment variable supplies the default for -c; concurrent tool installs no longer race.

CLI architecture and telemetry

  • NativeAOT entry point: enabled by default (opt out with DOTNET_CLI_ENABLEAOT=false). Commands such as dotnet --version, --info, --help, --cli-schema and dotnet sln list/migrate/remove run natively; everything else falls back to the managed CLI. Tools and external commands such as dotnet ef or dotnet dev-certs launch out of process, skipping the 600-700 ms managed startup.
  • MSBuild server: on by default; opt out with DOTNET_CLI_USE_MSBUILD_SERVER=false or MSBUILDUSESERVER=0. When the former is unset, the CLI no longer forces MSBUILDUSESERVER=0.
  • OpenTelemetry telemetry: replaces Application Insights with Azure Monitor and OTLP exporters; behavior and the DOTNET_CLI_TELEMETRY_OPTOUT opt-out are unchanged. The OTLP exporter also turns on when standard OTEL_EXPORTER_OTLP_* variables are present.
  • Optimized Native AOT publish: opt-in by setting both PublishAot and UseOptimizedPublish to true; the source says it becomes the default from .NET 12 Preview 1.
  • Partial Ready-to-Run: an MSBuild property meant for mobile workloads (macios, MAUI), not for apps.
  • Static Web Assets: Asset Groups, AdditionalEndpointDefinitions and TypeScript output integration.

dotnet test

  • MTP options: --no-dependencies, the DOTNET_TEST_RUNNER variable (VSTest or Microsoft.Testing.Platform), --use-current-runtime/--ucr, ! exclusions in --test-modules, per-assembly counts, --tl forwarding, live in-flight tests, two-stage Ctrl+C, live output with protocol 1.1.0.
  • Mobile testing: Android, iOS, macOS and Mac Catalyst with --device and the androidtest, iostest, macostest, maccatalysttest templates (MSTest by default); dotnet test -bl records everything in one binary log.
  • Run-level policies: --timeout 90s (exit code 3), --maximum-failed-tests 5 (exit code 13), --results-directory-layout per-module, default artifacts layout and --nologo.
  • Experimental: affected-test selection with --collect-test-map and --affected-tests, through a separate extension and DOTNET_CLI_ENABLE_AFFECTED_TESTS=1.
  • More: traversal projects (dotnet test dirs.proj), better reporters, dotnet new xunit --xunit-version v3 and dotnet new nunit --test-runner Microsoft.Testing.Platform.

MSBuild, NuGet and containers

  • Faster wildcards: with SDK 11.0.100 or Visual Studio 18.12, full evaluations are 10-13% faster with 16-34% fewer allocations (on four measured workloads).
  • NuGet: --min-publish-age-hours for dotnet nuget add source and update source; dotnet package add/update apply it; for floating references, restore fails with NU1020.
  • Containers: multi-arch builds with Podman, platform-native local runtimes preferred (wslc on Windows, container on macOS), reproducible publishing with SOURCE_DATE_EPOCH and an existing-manifest check (ContainerPushNoCache=true bypasses it).

Upgrading your SDK

.NET 11 is generally available. To install or upgrade the SDK, use these official pages, all verified with an HTTP request:

After installing, check the version with dotnet --version and, if you use a global.json, update it accordingly.

Sources

Comments (0)

No comments yet.

Leave a comment