Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,11 @@ Fix steps:
# as well as .zip packages, we only support the default en-US culture.
# Therefore, we only produce satellite assemblies for win7-x64, win7-x86, and win-arm64 by default (excluding min-size build),
# unless the caller wants to force produce localized resources.
$RemovePowerShellSatelliteAssemblies = $false
if (!$ForceProduceLocalizedResources -and ($Options.Runtime -notmatch '^(win7-x64|win7-x86|win-arm64)$' -or $ForMinimalSize)) {
# Disable satellite assemblies for other cultures.
# Disable satellite assemblies from package/runtime assets for other cultures.
$Arguments += "/property:SatelliteResourceLanguages=en"
$RemovePowerShellSatelliteAssemblies = $true
}

if ($Output -or $SMAOnly) {
Expand Down Expand Up @@ -743,6 +745,21 @@ Fix steps:
} finally {
Pop-Location
}

if ($RemovePowerShellSatelliteAssemblies) {
$smaResDll = 'System.Management.Automation.resources.dll'
$resDirs = Get-ChildItem -Path $publishPath -Filter $smaResDll -Recurse -Depth 1 | ForEach-Object DirectoryName

if ($resDirs) {
Write-Log -message "PowerShell satellite assemblies found under '$publishPath':"
$relatives = $resDirs | ForEach-Object { Resolve-Path $_ -Relative -RelativeBasePath $publishPath }
Comment thread
daxian-dbw marked this conversation as resolved.
Write-Log -message ($relatives -join ", ")

$resDirs | Remove-Item -Recurse -Force -ErrorAction Stop
Write-Log -message "Removed PowerShell satellite assemblies under '$publishPath'."
}
}

Write-LogGroupEnd -Title "Build PowerShell"

# No extra post-building task will run if '-SMAOnly' is specified, because its purpose is for a quick update of S.M.A.dll after full build.
Expand Down
Loading