question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set default TargetPlatformVersion for Windows

See original GitHub issue

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>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
dsplaistedcommented, Jun 25, 2020

We discovered recently that all projects that don’t specify a TargetPlatformVersion already have it set to 7.0 (whether they are intended to target Windows or not). See https://github.com/microsoft/msbuild/pull/5391 and https://github.com/dotnet/sdk/pull/12084.

So I think we can be confident there aren’t currently any other implications of this value.

Once we ship .NET 5, we will be stuck with the default target platform version for net5.0-windows, but we would be able to change the default platform version for future versions of .NET, e.g. net6.0-windows. So if we do start using this value to generate application manifests, we should consider changing the default TargetPlatformVersion for the .NET release that goes along with.

2reactions
dsplaistedcommented, Jun 30, 2020

@sfoslund @wli3 note my addition to the issue description:

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>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure projects to target platforms - Visual Studio
Learn how Visual Studio enables you to set up your applications to target different platforms, including the Arm64 platform.
Read more >
Windows UI Library - set TargetPlatformMinVersion and ...
First Approach: Please follow the instruction of how to change TargetplatformVersion: 1) Right-click on your project in Visual Studio.
Read more >
How to: Use the Windows SDK in a Windows Desktop ...
Open the project properties dialog. In the Configuration Properties > General section, notice the values of Windows Target Platform Version. ...
Read more >
How to: Modify the Target Framework and Platform Toolset ...
A new project uses the default .NET Framework and toolset of the Visual Studio version that you use to create the project.
Read more >
Parameter "targetPlatformVersion" cannot be null.
I have Windows 8.1 Enterprise 64 bit, Visual Studio 2017 Community ( installed with the default options of the default components ), Windows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found