Skip to content

Commit 60f4ca9

Browse files
authored
Merge pull request #55 from CommunityToolkit/fix/multitarget/winui3
Fixed UWP head when WinUI 3 is enabled
2 parents c50966c + b5de709 commit 60f4ca9

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

MultiTarget/DefinedConstants.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<PropertyGroup>
33
<DefineConstants Condition="'$(HasWinUI)' == 'true'">$(DefineConstants);WINUI$(WinUIMajorVersion);</DefineConstants>
44

5+
<!-- The WINAPPSDK const is the legacy version of the WINUI3 const. -->
6+
<DefineConstants Condition="'$(WinUIMajorVersion)' == '3'">$(DefineConstants);WINAPPSDK;</DefineConstants>
7+
58
<DefineConstants Condition="'$(IsUno)' == 'true'">$(DefineConstants);HAS_UNO;</DefineConstants>
69
<DefineConstants Condition="'$(IsUwp)' == 'true'">$(DefineConstants);WINDOWS_UWP;NETFX_CORE;</DefineConstants>
710
<DefineConstants Condition="'$(IsWinAppSdk)' == 'true'">$(DefineConstants);WINDOWS_WINAPPSDK;WINAPPSDK</DefineConstants>

MultiTarget/Library.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
<!-- Get the enabled MultiTarget features for this project / run -->
99
<Import Project="$(ToolingDirectory)\MultiTarget\EnabledMultiTargets.props" />
1010
<Import Project="$(ToolingDirectory)\MultiTarget\EnabledTargetFrameworks.props" />
11+
<Import Project="$(ToolingDirectory)\MultiTarget\WinUI.TargetVersion.props" />
1112

1213
<!-- Use <MultiTarget> values to define <TargetFrameworks> -->
1314
<Import Project="$(ToolingDirectory)\MultiTarget\MultiTargetToTargetFramework.props" />
1415

1516
<!-- Enable project identifiers -->
16-
<Import Project="$(ToolingDirectory)\MultiTarget\WinUI.TargetVersion.props" />
1717
<Import Project="$(ToolingDirectory)\MultiTarget\MultiTargetIdentifiers.props" />
1818
<Import Project="$(ToolingDirectory)\MultiTarget\DefinedConstants.props" />
1919

MultiTarget/MultiTargetIdentifiers.props

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,34 @@
2929
<MultiTargetsWasdk Condition="$(MultiTarget.Contains('wasdk')) == 'true'">true</MultiTargetsWasdk>
3030
<MultiTargetsNetstandard Condition="$(MultiTarget.Contains('netstandard')) == 'true'">true</MultiTargetsNetstandard>
3131

32-
<IsWasmHead Condition="$(IsDeployableHead) == 'true' AND '$(IsWasmHead)' == '' AND '$(TargetFramework)' == '$(WasmHeadTargetFramework)'">true</IsWasmHead>
33-
<IsWasmLib Condition="'$(IsWasmLib)' == '' AND '$(TargetFramework)' == '$(WasmLibTargetFramework)' AND '$(MultiTargetsWasm)' == 'true'">true</IsWasmLib>
32+
<IsWasmHead Condition="$(IsDeployableHead) == 'true' AND '$(IsWasmHead)' == '' AND '$(TargetFramework)' == '$(WasmHeadTargetFramework)' AND '$(WasmHeadTargetFramework)' != ''">true</IsWasmHead>
33+
<IsWasmLib Condition="'$(IsWasmLib)' == '' AND '$(TargetFramework)' == '$(WasmLibTargetFramework)' AND '$(MultiTargetsWasm)' == 'true' AND '$(WasmLibTargetFramework)' != ''">true</IsWasmLib>
3434
<IsWasm Condition="'$(IsWasm)' == '' AND ('$(IsWasmHead)' == 'true' or '$(IsWasmLib)' == 'true')">true</IsWasm>
3535

36-
<IsWpfHead Condition="$(IsDeployableHead) == 'true' AND '$(IsWpfHead)' == '' AND '$(TargetFramework)' == '$(WpfHeadTargetFramework)'">true</IsWpfHead>
37-
<IsWpfLib Condition="'$(IsWpfLib)' == '' AND '$(TargetFramework)' == '$(WpfLibTargetFramework)' AND '$(MultiTargetsWpf)' == 'true'">true</IsWpfLib>
36+
<IsWpfHead Condition="$(IsDeployableHead) == 'true' AND '$(IsWpfHead)' == '' AND '$(TargetFramework)' == '$(WpfHeadTargetFramework)' AND '$(WpfHeadTargetFramework)' != ''">true</IsWpfHead>
37+
<IsWpfLib Condition="'$(IsWpfLib)' == '' AND '$(TargetFramework)' == '$(WpfLibTargetFramework)' AND '$(WpfLibTargetFramework)' != '' AND '$(MultiTargetsWpf)' == 'true'">true</IsWpfLib>
3838
<IsWpf Condition="'$(IsWpf)' == '' AND ('$(IsWpfHead)' == 'true' or '$(IsWpfLib)' == 'true')">true</IsWpf>
3939

40-
<IsGtkHead Condition="$(IsDeployableHead) == 'true' AND '$(IsGtkHead)' == '' AND '$(TargetFramework)' == '$(LinuxHeadTargetFramework)'">true</IsGtkHead>
41-
<IsGtkLib Condition="'$(IsGtkLib)' == '' AND '$(TargetFramework)' == '$(LinuxLibTargetFramework)' AND '$(MultiTargetsLinuxGtk)' == 'true'">true</IsGtkLib>
40+
<IsGtkHead Condition="$(IsDeployableHead) == 'true' AND '$(IsGtkHead)' == '' AND '$(TargetFramework)' == '$(LinuxHeadTargetFramework)' AND '$(LinuxHeadTargetFramework)' != ''">true</IsGtkHead>
41+
<IsGtkLib Condition="'$(IsGtkLib)' == '' AND '$(TargetFramework)' == '$(LinuxLibTargetFramework)' AND '$(LinuxLibTargetFramework)' != '' AND '$(MultiTargetsLinuxGtk)' == 'true'">true</IsGtkLib>
4242
<IsGtk Condition="'$(IsGtk)' == '' AND ('$(IsGtkHead)' == 'true' or '$(IsGtkLib)' == 'true')">true</IsGtk>
4343

44-
<IsUwp Condition="'$(IsUwp)' == '' AND '$(TargetFramework)' == '$(UwpTargetFramework)' AND '$(MultiTargetsUwp)' == 'true'">true</IsUwp>
45-
<IsWinAppSdk Condition="'$(IsWinAppSdk)' == '' AND '$(TargetFramework)' == '$(WinAppSdkTargetFramework)' AND '$(MultiTargetsWasdk)' == 'true'">true</IsWinAppSdk>
46-
<IsDroid Condition="'$(IsDroid)' == '' AND '$(TargetFramework)' == '$(AndroidLibTargetFramework)' AND '$(MultiTargetsDroid)' == 'true'">true</IsDroid>
47-
<IsMacOS Condition="'$(IsMacOS)' == '' AND '$(TargetFramework)' == '$(MacOSLibTargetFramework)' AND '$(MultiTargetsMacOS)' == 'true'">true</IsMacOS>
48-
<IsiOS Condition="'$(IsiOS)' == '' AND '$(TargetFramework)' == '$(iOSLibTargetFramework)' AND '$(MultiTargetsiOS)' == 'true'">true</IsiOS>
44+
<IsUwp Condition="'$(IsUwp)' == '' AND '$(TargetFramework)' == '$(UwpTargetFramework)' AND '$(UwpTargetFramework)' != '' AND '$(MultiTargetsUwp)' == 'true'">true</IsUwp>
45+
<IsWinAppSdk Condition="'$(IsWinAppSdk)' == '' AND '$(TargetFramework)' == '$(WinAppSdkTargetFramework)' AND '$(WinAppSdkTargetFramework)' != '' AND '$(MultiTargetsWasdk)' == 'true'">true</IsWinAppSdk>
46+
<IsDroid Condition="'$(IsDroid)' == '' AND '$(TargetFramework)' == '$(AndroidLibTargetFramework)' AND '$(AndroidLibTargetFramework)' != '' AND '$(MultiTargetsDroid)' == 'true'">true</IsDroid>
47+
<IsMacOS Condition="'$(IsMacOS)' == '' AND '$(TargetFramework)' == '$(MacOSLibTargetFramework)' AND '$(MacOSLibTargetFramework)' != '' AND '$(MultiTargetsMacOS)' == 'true'">true</IsMacOS>
48+
<IsiOS Condition="'$(IsiOS)' == '' AND '$(TargetFramework)' == '$(iOSLibTargetFramework)' AND '$(iOSLibTargetFramework)' != '' AND '$(MultiTargetsiOS)' == 'true'">true</IsiOS>
4949
<IsNetstandard Condition="'$(IsNetstandard)' == '' AND $(MultiTargetsNetstandard) == 'true'">true</IsNetstandard>
5050

5151
<IsUno Condition="'$(IsWasm)' == 'true' OR '$(IsWpf)' == 'true' OR '$(IsGtk)' == 'true' OR '$(IsDroid)' == 'true' OR '$(IsMacOS)' == 'true' OR '$(IsiOS)' == 'true'">true</IsUno>
5252

5353
<HasWinUI Condition="'$(IsUwp)' == 'true' OR '$(IsWinAppSdk)' == 'true' OR '$(IsUno)' == 'true'">true</HasWinUI>
54+
55+
<!--
56+
This property is only for changing the version used by Uno.
57+
Force the version to 2 for UWP and 3 for WinAppSDK.
58+
-->
59+
<WinUIMajorVersion Condition="'$(IsUwp)' == 'true'">2</WinUIMajorVersion>
60+
<WinUIMajorVersion Condition="'$(IsWinAppSdk)' == 'true'">3</WinUIMajorVersion>
5461
</PropertyGroup>
5562
</Project>

ProjectHeads/SingleComponent/Wasm/ProjectTemplate.Wasm.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<IsUno>true</IsUno>
66
<IsWasm>true</IsWasm>
77
<IsWasmHead>true</IsWasmHead>
8+
<HasWinUI>true</HasWinUI>
89

910
<IsSingleExperimentHead>true</IsSingleExperimentHead>
1011
</PropertyGroup>

0 commit comments

Comments
 (0)