Skip to content

Set default TargetPlatformVersion for Windows #11233

@dsplaisted

Description

@dsplaisted

If the TargetFramework specifies windows as the TargetPlatformIdentifier but doesn't set the TargetPlatformVersion, then the SDK should set the version. This should go in the WindowsDesktop targets, and in the WindowsDesktop optional workload if/when it becomes an optional workload.

IE, the TargetFramework might be net5.0-windows. We haven't closed on what the default TargetPlatformVersion would be, but it might be 7, or some version of Windows 10 (10.0.18362).

Note that once this default is set for a given TargetFrameworkVersion, it can't be changed for that TargetFrameworkVersion, but for newer TargetFrameworkVersions it could be updated.

EDIT: For .NET 5.0 the default version of Windows should not be a version that includes WinRT APIs. This is because the CSWinRT shims for those APIs will add to the app size, and many WPF / Windows Forms apps won't use CSWinRT (but will have a TargetFramework of net5.0-windows).

EDIT: We also should normalize the casing of Windows for the TargetPlatformIdentifier. This is because it will be lower case when we parse a TargetFramework such as net5.0-windows. We may as well track normalizing the case with this issue. It's probably just the following code:

<!-- Normalize casing of windows to Windows -->
<TargetPlatformIdentifier Condition="'$(TargetPlatformIdentifier)' == 'Windows'">Windows</TargetPlatformIdentifier>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions