@@ -400,42 +400,41 @@ $Aspect = {
400400 if (-not $configurationXml ) { return }
401401
402402 if ($OutputPath ) {
403-
403+ $alreadyExportedTypeNames = @ {}
404+ $allTypeNames = @ ()
405+
404406 if ($outputPath -is [string ]) {
405407 $createdOutputFile = New-Item - ItemType File - Path $OutputPath - Force
406408 if (-not $createdOutputFile ) { return }
407409 $configurationXml.Save ($createdOutputFile.FullName )
408410 Get-Item - LiteralPath $createdOutputFile.FullName
409411 }
410- else {
412+ else {
411413 $fileOutputs = [Ordered ]@ {}
412414 $viewsXml = " <Views>$views </Views>" -as [xml ]
413415 if (-not $viewsXml ) { return }
414416 :nextView foreach ($view in $viewsXml.Views.View ) {
415417 $viewTypeNames = @ ($view.ViewSelectedBy.TypeName )
416418 if (($OutputPath -isnot [Collections.IDictionary ])) { continue }
417- foreach ($_ in $OutputPath.GetEnumerator ()) {
418- if ($_.Key -isnot [regex ] -and $_.Key -isnot [string ]) {
419- continue nextview
420- }
421- if ($_.Key -is [string ] -and -not ($viewTypeNames -like $_.Key )) {
422- continue nextview
423- }
424- if ($_.Key -is [Regex ] -and -not ($viewTypeNames -match $_.Key )) {
425- continue nextview
426- }
427- $kv = $_
428- if (-not $fileOutputs [$kv.Value ]) {
429- $fileOutputs [$kv.Value ] = @ ()
419+ foreach ($outPath in $OutputPath.GetEnumerator ()) {
420+ continue nextView if ($alreadyExportedTypeNames [$viewTypeNames ]) {}
421+ continue if ($outPath.Key -isnot [regex ] -and $outPath.Key -isnot [string ])
422+ continue if ($outPath.Key -is [string ] -and -not ($viewTypeNames -like $outPath.Key ))
423+ continue if ($outPath.Key -is [Regex ] -and -not ($viewTypeNames -match $outPath.Key ))
424+
425+ if (-not $fileOutputs [$outPath.Value ]) {
426+ $fileOutputs [$outPath.Value ] = @ ()
430427 }
431- $fileOutputs [$kv.Value ] += $view
428+ $fileOutputs [$outPath.Value ] += $view
429+ $alreadyExportedTypeNames [$viewTypeNames ] = $kv.Value
430+ continue nextView
432431 }
433432 }
434433 foreach ($fileOut in $fileOutputs.GetEnumerator ()) {
435434 $controlsInThisFile = [Ordered ]@ {}
436435
437436 $fileViews = "
438- <Views >$ ( foreach ($view in $fileOut.Value ) {
437+ <ViewDefinitions >$ ( foreach ($view in $fileOut.Value ) {
439438 $customControlReferences = $view.SelectNodes (" .//CustomControlName" )
440439 if (-not $customControlReferences ) { continue }
441440 $controlsXml = " <Controls>$Controls </Controls>" -as [xml ]
@@ -446,10 +445,10 @@ $Aspect = {
446445 }
447446 }
448447 $view.OuterXml
449- }) </Views >
448+ }) </ViewDefinitions >
450449 "
451450 $fileControls = if ($controlsInThisFile.Count ) {
452- @ ($controlsInThisFile.Values )
451+ " <Controls> $ ( @ ($controlsInThisFile.Values )) </Controls> "
453452 } else { $null }
454453 $fileXml = "
455454 <!-- Generated with EZOut $ ( $MyInvocation.MyCommand.Module.Version ) : Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
0 commit comments