Create powershell.config.json for PowerShell.Windows.x64 global tool (#23941)

This commit is contained in:
Aditya Patwardhan 2024-06-12 16:47:36 -07:00 committed by GitHub
parent 167a492415
commit bd8b0bd421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -287,6 +287,14 @@ jobs:
# remove PDBs to reduce the size of the nupkg
Remove-Item -Path "$outputPath\temp\tools\net9.0\any\*.pdb" -Recurse -Force
# create powershell.config.json
$config = [ordered]@{}
$config.Add("Microsoft.PowerShell:ExecutionPolicy", "RemoteSigned")
$config.Add("WindowsPowerShellCompatibilityModuleDenyList", @("PSScheduledJob", "BestPractices", "UpdateServices"))
$configPublishPath = Join-Path "$outputPath" 'temp' 'tools' 'net8.0' 'any' "powershell.config.json"
Set-Content -Path $configPublishPath -Value ($config | ConvertTo-Json) -Force -ErrorAction Stop
Compress-Archive -Path "$outputPath\temp\*" -DestinationPath "$outputPath\$nupkgName" -Force
Remove-Item -Path "$outputPath\temp" -Recurse -Force