Skip to content

Commit f342a14

Browse files
committed
Introduced IsWindowsTfm MultiTargetIdentifier shorthand
1 parent 446aa75 commit f342a14

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

MultiTarget/MultiTargetIdentifiers.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
<IsUwp Condition="'$(IsUwp)' == '' AND $(UwpTargetFramework.Contains('$(TargetFramework);')) AND '$(UwpTargetFramework)' != '' AND '$(MultiTargetsUwp)' == 'true'">true</IsUwp>
4545
<IsWinAppSdk Condition="'$(IsWinAppSdk)' == '' AND $(WinAppSdkTargetFramework.Contains('$(TargetFramework);')) AND '$(WinAppSdkTargetFramework)' != '' AND '$(MultiTargetsWasdk)' == 'true'">true</IsWinAppSdk>
46+
<IsWindowsTfm Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">true</IsWindowsTfm>
4647

4748
<IsDroid Condition="'$(IsDroid)' == '' AND $(AndroidLibTargetFramework.Contains('$(TargetFramework);')) AND '$(AndroidLibTargetFramework)' != '' AND '$(MultiTargetsDroid)' == 'true'">true</IsDroid>
4849
<IsMacOS Condition="'$(IsMacOS)' == '' AND $(MacOSLibTargetFramework.Contains('$(TargetFramework);')) AND '$(MacOSLibTargetFramework)' != '' AND '$(MultiTargetsMacOS)' == 'true'">true</IsMacOS>
@@ -60,6 +61,6 @@
6061
<WinUIMajorVersion Condition="'$(HasWinUI)' == 'true' AND '$(IsUwp)' == 'true' AND $(WinUIMajorVersion) == ''">2</WinUIMajorVersion>
6162
<WinUIMajorVersion Condition="'$(HasWinUI)' == 'true' AND '$(IsWinAppSdk)' == 'true' AND $(WinUIMajorVersion) == ''">3</WinUIMajorVersion>
6263

63-
<UseUwp Condition="'$(HasWinUI)' == 'true' AND '$(IsUwp)' == 'true' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">true</UseUwp>
64+
<UseUwp Condition="'$(HasWinUI)' == 'true' AND '$(IsUwp)' == 'true' AND '$(IsWindowsTfm)' == 'true'">true</UseUwp>
6465
</PropertyGroup>
6566
</Project>

MultiTarget/NoWarn.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<!-- Disable warnings for 'This call site is reachable on all platforms.' caused by underlying platform. -->
3-
<PropertyGroup Condition="'$(IsUwp)' == 'true' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
3+
<PropertyGroup Condition="'$(IsUwp)' == 'true' AND '$(IsWindowsTfm)' == 'true'">
44
<NoWarn>$(NoWarn);CA1416;NETSDK1219;</NoWarn>
55
</PropertyGroup>
66

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project>
22
<ItemGroup>
33
<PackageReference Condition="'$(HasWinUI)' == 'true'" Include="Microsoft.UI.Xaml" Version="2.8.7-prerelease.241119001" />
4-
<PackageReference Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'" Include="Microsoft.Windows.CsWinRT" Version="2.1.6" PrivateAssets="all" />
4+
<PackageReference Condition="'$(IsWindowsTfm)' == 'true'" Include="Microsoft.Windows.CsWinRT" Version="2.1.6" PrivateAssets="all" />
55

66
<!-- Temp workaround until next Windows SDK servicing update -->
7-
<PackageReference Condition="'$(HasWinUI)' == 'true' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'" Include="Microsoft.Windows.SDK.CPP" Version="10.0.26100.2454" PrivateAssets="all" />
7+
<PackageReference Condition="'$(HasWinUI)' == 'true' AND '$(IsWindowsTfm)' == 'true'" Include="Microsoft.Windows.SDK.CPP" Version="10.0.26100.2454" PrivateAssets="all" />
88
</ItemGroup>
99
</Project>

MultiTarget/WinUI.Extra.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
-->
1818
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
1919
<SupportedOSPlatformVersion>$(TargetPlatformMinVersion)</SupportedOSPlatformVersion>
20-
<TargetPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.26100.0</TargetPlatformVersion>
21-
<TargetPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">10.0.19041.0</TargetPlatformVersion>
20+
<TargetPlatformVersion Condition="'$(IsWindowsTfm)' == 'true'">10.0.26100.0</TargetPlatformVersion>
21+
<TargetPlatformVersion Condition="'$(IsWindowsTfm)' != 'true'">10.0.19041.0</TargetPlatformVersion>
2222
</PropertyGroup>
2323

2424
<!-- Workaround, improved error message when consuming from Uno projects with mismatched TFMs -->
@@ -32,8 +32,8 @@
3232
<PropertyGroup Condition="'$(IsUwp)' == 'true'">
3333
<Platforms>x86;x64;arm64</Platforms>
3434

35-
<WindowsSdkPackageVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.26100.54</WindowsSdkPackageVersion>
36-
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
35+
<WindowsSdkPackageVersion Condition="'$(IsWindowsTfm)' == 'true'">10.0.26100.54</WindowsSdkPackageVersion>
36+
<RuntimeIdentifiers Condition="'$(IsWindowsTfm)' == 'true'">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
3737
</PropertyGroup>
3838

3939
<PropertyGroup Condition="'$(IsWinAppSdk)' == 'true'">
@@ -58,7 +58,7 @@
5858
</PropertyGroup>
5959

6060
<!-- Disable warnings for 'This call site is reachable on all platforms.' caused by underlying platform. -->
61-
<PropertyGroup Condition="'$(IsUwp)' == 'true' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
61+
<PropertyGroup Condition="'$(IsUwp)' == 'true' AND '$(IsWindowsTfm)' == 'true'">
6262
<NoWarn>$(NoWarn);CA1416;</NoWarn>
6363
</PropertyGroup>
6464

ToolkitComponent.SampleProject.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!-- Set up the MultiTarget system -->
77
<Import Project="$(ToolingDirectory)\MultiTarget\Library.props" />
88

9-
<Sdk Condition="'$(IsUwp)' == 'true' AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'" Name="MSBuild.Sdk.Extras" Version="3.0.23" />
9+
<Sdk Condition="'$(IsUwp)' == 'true' AND '$(IsWindowsTfm)' != 'true'" Name="MSBuild.Sdk.Extras" Version="3.0.23" />
1010

1111
<!-- Import this component's source project -->
1212
<ItemGroup>

0 commit comments

Comments
 (0)