Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ Copyright (c) .NET Foundation. All rights reserved.

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'Windows'">
<!-- Normalize the last part of TFM to .0 when ending with .1 as that indicates the use of the CsWinRT 3.0 verison. -->
<_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)">
<NormalizedSupportedTargetPlatformVersion
Condition="$([System.Version]::Parse('%(Identity)').Revision) == 1">$([System.Version]::Parse('%(Identity)').Major).$([System.Version]::Parse('%(Identity)').Minor).$([System.Version]::Parse('%(Identity)').Build).0</NormalizedSupportedTargetPlatformVersion>
</_NormalizedWindowsSdkSupportedTargetPlatformVersion>
<SdkSupportedTargetPlatformVersion Include="@(_NormalizedWindowsSdkSupportedTargetPlatformVersion)" />
<_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)">
<NormalizedSupportedTargetPlatformVersion
Condition="$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').Length) == 4 And
$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(3)) == '1'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately in the speculative-evaluation path GetValue({}) throws an IndexOutOfRangeException. Thinking of alternatives.

>$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(0)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(1)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(2)).0</NormalizedSupportedTargetPlatformVersion>
Comment on lines +29 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK in the debugger this works with no internal exceptions:

Suggested change
Condition="$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').Length) == 4 And
$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(3)) == '1'"
>$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(0)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(1)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(2)).0</NormalizedSupportedTargetPlatformVersion>
Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(%(Identity), '^((\d+\.){3})1$'))"
>$([System.Text.RegularExpressions.Regex]::Replace(%(Identity), '^((\d+\.){3})1$', '${1}0'))</NormalizedSupportedTargetPlatformVersion>

</_NormalizedWindowsSdkSupportedTargetPlatformVersion>
<SdkSupportedTargetPlatformVersion Include="@(_NormalizedWindowsSdkSupportedTargetPlatformVersion)" />
</ItemGroup>
</Project>
Loading