Skip to content
3 changes: 3 additions & 0 deletions docs/framework/migration-guide/retargeting/4.5.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Retargeting changes for migration to .NET Framework 4.5.x
description: Find information about application compatibility issues that might affect your app when migrating to .NET Framework 4.5.x.
ms.date: 07/31/2023
author: "chlowell"
ai-usage: ai-assisted
---

# Retargeting changes for migration to .NET Framework 4.5.x
Expand Down Expand Up @@ -43,6 +44,8 @@ This article lists the app compatibility issues that were introduced in .NET Fra

[!INCLUDE[EncoderParameter ctor is obsolete](~/includes/migration-guide/retargeting/winforms/encoderparameter-ctor-obsolete.md)]

[!INCLUDE[SubsystemVersion defaults to 6.00 for .NET Framework 4.5 Windows Forms apps](~/includes/migration-guide/retargeting/winforms/subsystemversion-defaults-to-600.md)]

### Windows Communication Foundation (WCF)

[!INCLUDE [onwritebodycontents-change](~/includes/migration-guide/retargeting/wcf/onwritebodycontents-change.md)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
ms.topic: include
ai-usage: ai-assisted
---

### SubsystemVersion defaults to 6.00 when you retarget Windows Forms applications to .NET Framework 4.5

#### Details

When you build Windows Forms apps after retargeting to .NET Framework 4.5, the default `SubsystemVersion` changes from `4.00` to `6.00`. Windows uses the subsystem version when it reports some window metrics. As a result, code that calculates window or form sizes from <xref:System.Windows.Forms.SystemInformation?displayProperty=nameWithType> values, such as <xref:System.Windows.Forms.SystemInformation.FixedFrameBorderSize?displayProperty=nameWithType>, might produce different layout results than the same code produced on .NET Framework 4.

#### Suggestion

If you must preserve the .NET Framework 4 sizing behavior, set `SubsystemVersion` to `4.00` in your project file:

```xml
<PropertyGroup>
<SubsystemVersion>4.00</SubsystemVersion>
</PropertyGroup>
```

You can also use the [SubsystemVersion compiler option for C#](/dotnet/csharp/language-reference/compiler-options/advanced#subsystemversion) or the [SubsystemVersion compiler option for Visual Basic](/dotnet/visual-basic/reference/command-line-compiler/subsystemversion).
Comment thread
adegeo marked this conversation as resolved.

Review your code that sizes or positions Windows Forms UI with <xref:System.Windows.Forms.SystemInformation?displayProperty=nameWithType> values or other `GetSystemMetrics`-based values.

| Name | Value |
|:--------|:------------|
| Scope | Minor |
| Version | 4.5 |
| Type | Retargeting |
Comment thread
Copilot marked this conversation as resolved.

#### Affected APIs

- <xref:System.Windows.Forms.SystemInformation?displayProperty=nameWithType>
- <xref:System.Windows.Forms.SystemInformation.FixedFrameBorderSize?displayProperty=nameWithType>
Loading