microsoft / microsoft/aspire

The `TargetFramework` environment variable isn’t honored when using the dotnet run command with the Interactive TFM option in .NET 11 Preview 1

Open
#14,436 1 comment 0 reactions 0 assignees View on GitHub
needs-area-label
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.

Since .NET MAUI is multi-targeted from a single project, it's necessary to specify the TFM to run the project from Aspire.

Before .NET 11 Preview 1, have mentioned it using the `WithEnvironment()` method passing `TargetFramework` and the corresponding `TFM` value as parameters.

```cs
builder.AddProject("mauiapp-windows")
.WithEnvironment("TargetFramework", "net11.0-windows10.0.19041.0")
.WithIconName("Desktop");
```

Starting with .NET 11 Preview 1, the Interactive Framework selection has been introduced, but it is not working with the TargetFramework variable set.

### Describe the solution you'd like

Please map the `TargetFramework` environment variable to the framework parameter in the dotnet run command.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.