@@ -635,32 +635,41 @@ Fix steps:
635
635
}
636
636
637
637
# publish powershell.config.json
638
- $config = @ {}
638
+ $config = [ ordered ] @ {}
639
639
640
640
if ($Options.Runtime -like " *win*" ) {
641
- # Execution Policy is only supported on Windows
642
- $config = @ { " Microsoft.PowerShell:ExecutionPolicy" = " RemoteSigned" ;
643
- " WindowsPowerShellCompatibilityModuleDenyList" = @ (" PSScheduledJob" , " BestPractices" , " UpdateServices" )
644
- }
641
+ # Execution Policy and WinCompat feature are only supported on Windows.
642
+ $config.Add (" Microsoft.PowerShell:ExecutionPolicy" , " RemoteSigned" )
643
+ $config.Add (" WindowsPowerShellCompatibilityModuleDenyList" , @ (" PSScheduledJob" , " BestPractices" , " UpdateServices" ))
645
644
}
646
645
647
646
if (-not $SkipExperimentalFeatureGeneration -and
648
647
(Test-IsPreview $psVersion ) -and
649
648
-not (Test-IsReleaseCandidate $psVersion )
650
649
) {
651
-
652
- $ExperimentalFeatureJsonFilePath = if ($Options.Runtime -like " *win*" ) {
653
- " $PSScriptRoot /experimental-feature-windows.json"
650
+ if (-not $env: PS_RELEASE_BUILD -and -not $Runtime.Contains (" arm" ) -and -not ($Runtime -like ' fxdependent*' )) {
651
+ Write-Verbose " Build experimental feature list by running 'Get-ExperimentalFeature'" - Verbose
652
+ $json = & $publishPath \pwsh - noprofile - command {
653
+ $expFeatures = Get-ExperimentalFeature | ForEach-Object - MemberName Name
654
+ ConvertTo-Json $expFeatures
655
+ }
654
656
} else {
655
- " $PSScriptRoot /experimental-feature-linux.json"
656
- }
657
+ Write-Verbose " Build experimental feature list by using the pre-generated JSON files" - Verbose
658
+ $ExperimentalFeatureJsonFilePath = if ($Options.Runtime -like " *win*" ) {
659
+ " $PSScriptRoot /experimental-feature-windows.json"
660
+ } else {
661
+ " $PSScriptRoot /experimental-feature-linux.json"
662
+ }
663
+
664
+ if (-not (Test-Path $ExperimentalFeatureJsonFilePath )) {
665
+ throw " ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist"
666
+ }
657
667
658
- if (-not (Test-Path $ExperimentalFeatureJsonFilePath )) {
659
- throw " ExperimentalFeatureJsonFilePath: $ExperimentalFeatureJsonFilePath does not exist"
668
+ $json = Get-Content - Raw $ExperimentalFeatureJsonFilePath
660
669
}
661
670
662
- $json = Get-Content - Raw $ExperimentalFeatureJsonFilePath
663
- $config += @ { ExperimentalFeatures = ([ string []] ( $json | ConvertFrom-Json )) }
671
+ $config .Add ( ' ExperimentalFeatures ' , [ string []]( $ json | ConvertFrom-Json ));
672
+
664
673
} else {
665
674
Write-Warning - Message " Experimental features are not enabled in powershell.config.json file"
666
675
}
0 commit comments