microsoft / microsoft/aspire

Revisit target framework defaults and selection in `aspire new` for .NET 11

Open
#19,212 0 comments 0 reactions 0 assignees View on GitHub
area-cli area-templates enhancement
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

.NET 11 is currently an opt-in target framework in the Aspire project templates, while `net10.0` remains the default. The underlying `dotnet new` templates allow users to opt in explicitly, for example:

```console
dotnet new aspire-starter --framework net11.0
```

However, `aspire new` does not expose or forward the template's `Framework` option. Consequently, users of the Aspire CLI cannot select a supported target framework and must either use `dotnet new` directly or edit all generated project files afterward.

This gap has surfaced previously:

- #9931 explicitly reported that `aspire new` lacked framework selection, but was closed after `net10.0` became the default.
- #19050 revisited the default when only .NET 11 was installed and was closed as by design because preview TFMs are opt-in. A follow-up comment highlighted that `aspire new` provides no way to perform that opt-in.
- #9480 added per-template option handling to `aspire new`, but the target-framework option is not currently among the options exposed for the C# templates.

### Describe the solution you'd like

Revisit target-framework behavior in `aspire new` as part of .NET 11 support and make explicit decisions for both of these questions:

1. **Default:** When should the C# Aspire templates change their default target framework from `net10.0` to `net11.0`?
2. **Selection:** Should `aspire new` expose `-f|--framework ` for templates containing .NET projects, matching the supported values defined by the underlying template?

If framework selection is added, expected behavior would include:

```console
aspire new aspire-starter --framework net11.0
aspire new aspire-empty --framework net10.0
```

- The option is shown in template-specific help with the supported values.
- The selected framework is applied consistently to every generated .NET project.
- Non-interactive usage can select a framework without prompts.
- Omitting the option continues to use the template's documented default.
- Templates that do not contain .NET projects do not expose the option.

### Additional context

SDK selection, Aspire template/package version selection, and project target-framework selection are separate concerns. The existing `aspire new --version` option selects the Aspire project-template package version; it does not select the generated projects' target framework.

Related framework-support history: #18849 added opt-in .NET 11 support, while #12267 changed the template default to .NET 10 shortly before .NET 10 GA.

Contributor guide

Open the contributing guide

Research direction

Start at the `aspire new` CLI entry point and review the per-template option handling added in #9480, then compare it with the C# templates' supported `Framework` option. Define the default and selection behavior, including help, non-interactive use, consistent application to generated projects, and omission for templates without .NET projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.