Skip to content

Commit d3e10ff

Browse files
committed
Avoid parsing %(Identity% as version
1 parent 5b52129 commit d3e10ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ Copyright (c) .NET Foundation. All rights reserved.
2424

2525
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'Windows'">
2626
<!-- Normalize the last part of TFM to .0 when ending with .1 as that indicates the use of the CsWinRT 3.0 verison. -->
27-
<_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)">
28-
<NormalizedSupportedTargetPlatformVersion
29-
Condition="$([System.Version]::Parse('%(Identity)').Revision) == 1">$([System.Version]::Parse('%(Identity)').Major).$([System.Version]::Parse('%(Identity)').Minor).$([System.Version]::Parse('%(Identity)').Build).0</NormalizedSupportedTargetPlatformVersion>
30-
</_NormalizedWindowsSdkSupportedTargetPlatformVersion>
31-
<SdkSupportedTargetPlatformVersion Include="@(_NormalizedWindowsSdkSupportedTargetPlatformVersion)" />
27+
<_NormalizedWindowsSdkSupportedTargetPlatformVersion Include="@(WindowsSdkSupportedTargetPlatformVersion)">
28+
<NormalizedSupportedTargetPlatformVersion
29+
Condition="$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').Length) == 4 And
30+
$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(3)) == '1'"
31+
>$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(0)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(1)).$([MSBuild]::ValueOrDefault('%(Identity)', '').Split('.').GetValue(2)).0</NormalizedSupportedTargetPlatformVersion>
32+
</_NormalizedWindowsSdkSupportedTargetPlatformVersion>
33+
<SdkSupportedTargetPlatformVersion Include="@(_NormalizedWindowsSdkSupportedTargetPlatformVersion)" />
3234
</ItemGroup>
3335
</Project>

0 commit comments

Comments
 (0)