59
59
Param (
60
60
[ValidateSet (' all' , ' wasm' , ' uwp' , ' wasdk' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' , ' netstandard' )]
61
61
[Alias (" mt" )]
62
- [string []]$MultiTargets = @ (' uwp' , ' wasdk ' , ' wasm' ), # default settings
62
+ [string []]$MultiTargets = @ (' uwp' , ' wasm' ), # default settings
63
63
64
64
[ValidateSet (' wasm' , ' uwp' , ' wasdk' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' , ' netstandard' )]
65
65
[string []]$ExcludeMultiTargets = @ (), # default settings
@@ -207,6 +207,12 @@ function Invoke-MSBuildWithBinlog {
207
207
}
208
208
}
209
209
210
+ # List of WinUI-2 compatible multitargets
211
+ $WinUI2MultiTargets = @ (' uwp' , ' wasm' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' )
212
+
213
+ # List of WinUI-3 compatible multitargets
214
+ $WinUI3MultiTargets = @ (' wasdk' , ' wasm' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' )
215
+
210
216
# Components are built individually
211
217
foreach ($ComponentName in $Components ) {
212
218
# Find all components source csproj (when wildcard), or find specific component csproj by name.
@@ -215,26 +221,45 @@ foreach ($ComponentName in $Components) {
215
221
$componentPath = Get-Item " $componentCsproj /../../"
216
222
$componentName = $ ($componentPath.BaseName );
217
223
218
- if ($componenName -in $ExcludeComponents ) {
224
+ if ($componentName -in $ExcludeComponents ) {
219
225
continue ;
220
226
}
221
227
222
228
# Get supported MultiTarget for this component
223
229
$supportedMultiTargets = & $PSScriptRoot \MultiTarget\Get-MultiTargets.ps1 - component $componentName
224
-
230
+
231
+ # If the component does not support at least one target that supports the requested WinUI major version, skip the component
232
+ $isWinUIMajorVersionSupported = $false
233
+
225
234
# Flag to check if any of the requested targets are supported by the component
226
- $isTargetSupported = $false
235
+ $isRequestedTargetSupported = $false
227
236
228
237
foreach ($requestedTarget in $MultiTargets ) {
229
- if ($requestedTarget -in $supportedMultiTargets ) {
230
- $isTargetSupported = $true
231
- break
238
+ if ($false -eq $isRequestedTargetSupported ) {
239
+ $isRequestedTargetSupported = $requestedTarget -in $supportedMultiTargets
240
+ }
241
+ }
242
+
243
+ foreach ($supportedMultiTarget in $supportedMultiTargets ) {
244
+ if ($false -eq $isWinUIMajorVersionSupported ) {
245
+ if ($WinUIMajorVersion -eq 2 ) {
246
+ $isWinUIMajorVersionSupported = $supportedMultiTarget -in $WinUI2MultiTargets ;
247
+ }
248
+
249
+ if ($WinUIMajorVersion -eq 3 ) {
250
+ $isWinUIMajorVersionSupported = $supportedMultiTarget -in $WinUI3MultiTargets ;
251
+ }
232
252
}
233
253
}
234
254
235
255
# If none of the requested targets are supported by the component, we can skip build to save time and avoid errors.
236
- if (-not $isTargetSupported ) {
237
- Write-Warning " Skipping $ ( $componentPath.BaseName ) , none of the requested MultiTargets are enabled for this component."
256
+ if (-not $isRequestedTargetSupported ) {
257
+ Write-Warning " Skipping $ ( $componentPath.BaseName ) , none of the requested MultiTargets '$MultiTargets ' are enabled for this component."
258
+ continue
259
+ }
260
+
261
+ if (-not $isWinUIMajorVersionSupported ) {
262
+ Write-Warning " Skipping $ ( $componentPath.BaseName ) , none of the supported MultiTargets '$supportedMultiTargets ' support WinUI $WinUIMajorVersion ."
238
263
continue
239
264
}
240
265
0 commit comments