Skip to content

Commit

Permalink
OutputType breaking change (#20547)
Browse files Browse the repository at this point in the history
  • Loading branch information
gewarren authored Sep 15, 2020
1 parent e153b9b commit 18b6055
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/core/compatibility/3.1-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,18 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v

## Windows Forms

- [OutputType set to WinExe for WPF and WinForms apps](#outputtype-set-to-winexe-for-wpf-and-winforms-apps)
- [DataGridView-related APIs now throw InvalidOperationException](#datagridview-related-apis-now-throw-invalidoperationexception)
- [WinForms and WPF apps use Microsoft.NET.Sdk](#winforms-and-wpf-apps-use-microsoftnetsdk)
- [Removed status bar controls](#removed-status-bar-controls)
- [WinForms methods now throw ArgumentException](#winforms-methods-now-throw-argumentexception)
- [WinForms methods now throw ArgumentNullException](#winforms-methods-now-throw-argumentnullexception)
- [WinForms properties now throw ArgumentOutOfRangeException](#winforms-properties-now-throw-argumentoutofrangeexception)

[!INCLUDE [automatically-infer-winexe-output-type](../../../includes/core-changes/windowsforms/5.0/automatically-infer-winexe-output-type.md)]

***

[!INCLUDE [null-owner-causes-invalidoperationexception](../../../includes/core-changes/windowsforms/5.0/null-owner-causes-invalidoperationexception.md)]

***
Expand All @@ -389,8 +394,13 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v

## Windows Presentation Framework (WPF)

- [OutputType set to WinExe for WPF and WinForms apps](#outputtype-set-to-winexe-for-wpf-and-winforms-apps)
- [WinForms and WPF apps use Microsoft.NET.Sdk](#winforms-and-wpf-apps-use-microsoftnetsdk)

[!INCLUDE [automatically-infer-winexe-output-type](../../../includes/core-changes/windowsforms/5.0/automatically-infer-winexe-output-type.md)]

***

[!INCLUDE [sdk-and-target-framework-change](../../../includes/core-changes/windowsforms/5.0/sdk-and-target-framework-change.md)]

***
5 changes: 5 additions & 0 deletions docs/core/compatibility/winforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The following breaking changes are documented on this page:

| Breaking change | Version introduced |
| - | :-: |
| [OutputType set to WinExe for WPF and WinForms apps](#outputtype-set-to-winexe-for-wpf-and-winforms-apps) | 5.0 |
| [DataGridView-related APIs now throw InvalidOperationException](#datagridview-related-apis-now-throw-invalidoperationexception) | 5.0 |
| [WinForms and WPF apps use Microsoft.NET.Sdk](#winforms-and-wpf-apps-use-microsoftnetsdk) | 5.0 |
| [Removed status bar controls](#removed-status-bar-controls) | 5.0 |
Expand All @@ -33,6 +34,10 @@ The following breaking changes are documented on this page:

## .NET 5.0

[!INCLUDE [automatically-infer-winexe-output-type](../../../includes/core-changes/windowsforms/5.0/automatically-infer-winexe-output-type.md)]

***

[!INCLUDE [null-owner-causes-invalidoperationexception](../../../includes/core-changes/windowsforms/5.0/null-owner-causes-invalidoperationexception.md)]

***
Expand Down
5 changes: 5 additions & 0 deletions docs/core/compatibility/wpf.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ The following breaking changes are documented on this page:

| Breaking change | Version introduced |
| - | :-: |
| [OutputType set to WinExe for WPF and WinForms apps](#outputtype-set-to-winexe-for-wpf-and-winforms-apps) | 5.0 |
| [WinForms and WPF apps use Microsoft.NET.Sdk](#winforms-and-wpf-apps-use-microsoftnetsdk) | 5.0 |

## .NET 5.0

[!INCLUDE [automatically-infer-winexe-output-type](../../../includes/core-changes/windowsforms/5.0/automatically-infer-winexe-output-type.md)]

***

[!INCLUDE [sdk-and-target-framework-change](../../../includes/core-changes/windowsforms/5.0/sdk-and-target-framework-change.md)]

***
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
### OutputType set to WinExe for WPF and WinForms apps

`OutputType` is automatically set to `WinExe` for Windows Presentation Foundation (WPF) and Windows Forms apps. When `OutputType` is set to `WinExe`, a console window doesn't open when the app is executed.

#### Change description

In previous versions of .NET, the value that's specified for `OutputType` in the project file is used. For example:

```xml
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
```

Starting in .NET 5.0, `OutputType` is automatically set to `WinExe` for WPF and Windows Forms apps. For example:

```xml
<PropertyGroup>
<OutputType>WinExe</OutputType>
</PropertyGroup>
```

#### Reason for change

It's assumed that most users don't want a console window to open when a WPF or Windows Forms app is executed. In addition, [now that these application types use the .NET SDK](../../../../docs/core/compatibility/wpf.md#winforms-and-wpf-apps-use-microsoftnetsdk) instead of the Windows Desktop SDK, the correct default will be set. Further, when support for targeting iOS and Android is added, it will be easier to multi-target between multiple platforms if they all use the same output type.

#### Version introduced

.NET 5.0 Preview 8

#### Recommended action

No action is required in your part. However, if you want to revert to the old behavior, set the `DisableWinExeOutputInference` property to `true` in your project file.

```xml
<DisableWinExeOutputInference>true</DisableWinExeOutputInference>
```

#### Category

- Windows Forms
- Windows Presentation Framework (WPF)

#### Affected APIs

Not detectable via API analysis.

<!--
#### Affected APIs
Not detectable via API analysis.
-->

0 comments on commit 18b6055

Please sign in to comment.