Skip to content

[Breaking change]: OutputType no longer automatically set to WinExe for WPF and WinForms apps #25636

@dsplaisted

Description

@dsplaisted

Description

In .NET 5, we automatically converted an OutputType of Exe to WinExe for WPF and Windows forms apps. This was intended to simplify .NET MAUI apps (so that the OutputType wouldn't need to be conditioned on the TargetFramework).

However:

  • This broke user expectations and frustrated some folks. See Revert DisableWinExeOutputInference sdk#16563 and other linked issues
  • .NET MAUI apps are going to by default use WinUI, not Windows Forms or WPF, so this logic won't even apply to them

So we are reverting to the original behavior in .NET 6.

Version

.NET 6 RC1

Previous behavior

If a project targeted .NET 5 or higher, the OutputType was Exe, and UseWindowsForms or UseWPF was set to true, then the .NET SDK would change the OutputType to WinExe.

New behavior

The OutputType is no longer changed from what is in the project file.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

The previous breaking change was more impactful than expected and ended up not being the right logic for .NET Maui.

Recommended action

If you relied on the fact that the OutputType was changed from Exe to WinExe, you will now need to explicitly set it to WinExe.

If you were impacted by the previous breaking change and had to set DisableWinExeOutputInference in order to disable the logic that was added in .NET 5, you can remove that property.

Feature area

SDK

Affected APIs

No response

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 6Issues and PRs for the .NET 6 releasebreaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions