Fix min-size package and ship localized resources only for MSIX packages (#27725)

This commit is contained in:
Dongbo Wang authored and GitHub committed 2026-07-29 11:54:26 -07:00
1 parent f3648da945
commit b7cbb7a35a
5 files changed
+642 -925

No files matched your search

@@ -177,8 +177,6 @@ jobs:
Where-Object { -not $_.PSIsContainer } |
Where-Object { $_.name -notin $filesToKeep } |
Remove-Item -Verbose
displayName: 'Build Winx64 Global tool'
condition: and(succeeded(), eq(variables['Architecture'], 'fxdependent'))
env:
+2 -2
View File
@@ -205,8 +205,8 @@
<AppHostDotNetSearch>AppLocal</AppHostDotNetSearch>
</PropertyGroup>
<!-- Enable ready-to-run only for Release configuration -->
<PropertyGroup Condition=" '$(AppDeployment)' == 'SelfContained' And '$(Configuration)' == 'Release' ">
<!-- Enable ready-to-run only for Release configuration except for the min-size build -->
<PropertyGroup Condition=" '$(AppDeployment)' == 'SelfContained' And '$(Configuration)' == 'Release' And '$(ForMinimalSize)' != 'True' ">
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
</PropertyGroup>
+14 -1
View File
@@ -24,7 +24,20 @@
</Dependencies>
<Resources>
<Resource Language="en-us"/>
<Resource Language="en-US"/>
<Resource Language="cs"/>
<Resource Language="de"/>
<Resource Language="es"/>
<Resource Language="fr"/>
<Resource Language="it"/>
<Resource Language="ja"/>
<Resource Language="ko"/>
<Resource Language="pl"/>
<Resource Language="pt-BR"/>
<Resource Language="ru"/>
<Resource Language="tr"/>
<Resource Language="zh-Hans"/>
<Resource Language="zh-Hant"/>
</Resources>
<Applications>
+24 -6
View File
@@ -361,6 +361,8 @@ function Start-PSBuild {
Indicates a CI build; restores the Pester module to the output directory.
.PARAMETER ForMinimalSize
Produces a build optimized for minimal binary size (linux-x64, win7-x64, or osx-x64 only).
.PARAMETER ForceProduceLocalizedResources
Forces the build to produce satellite assemblies for all cultures, even when not required.
.PARAMETER SkipExperimentalFeatureGeneration
Skips the step that runs the built pwsh to produce the experimental-features list.
.PARAMETER SMAOnly
@@ -401,6 +403,7 @@ function Start-PSBuild {
[switch]$NoPSModuleRestore,
[switch]$CI,
[switch]$ForMinimalSize,
[switch]$ForceProduceLocalizedResources,
# Skips the step where the pwsh that's been built is used to create a configuration
# Useful when changing parsing/compilation, since bugs there can mean we can't get past this step
@@ -553,11 +556,20 @@ Fix steps:
Stop-DevPowerShell
}
# setup arguments
# adding ErrorOnDuplicatePublishOutputFiles=false due to .NET SDk issue: https://github.com/dotnet/sdk/issues/15748
# removing --no-restore due to .NET SDK issue: https://github.com/dotnet/sdk/issues/18999
# $Arguments = @("publish","--no-restore","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false")
$Arguments = @("publish","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false")
# Setup arguments
# Added ErrorOnDuplicatePublishOutputFiles=false due to .NET SDK issue: https://github.com/dotnet/sdk/issues/15748
# Removed the option "--no-restore" due to .NET SDK issue: https://github.com/dotnet/sdk/issues/18999
$Arguments = @("publish", "/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false")
# Today, we only support localization for MSIX packages. For Linux and macOS packages, fxdependent and min-size packages,
# 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.
if (!$ForceProduceLocalizedResources -and ($Options.Runtime -notmatch '^(win7-x64|win7-x86|win-arm64)$' -or $ForMinimalSize)) {
# Disable satellite assemblies for other cultures.
$Arguments += "/property:SatelliteResourceLanguages=en"
}
if ($Output -or $SMAOnly) {
$Arguments += "--output", (Split-Path $Options.Output)
}
@@ -596,7 +608,7 @@ Fix steps:
# We pass in the AppDeployment property to indicate which type of deployment we are doing.
# This allows the PowerShell.Common.props to set the correct properties for the build.
$AppDeployment = if(($Options.Runtime -like 'fxdependent*' -or $ForMinimalSize) -and $Options.Runtime -notmatch $optimizedFddRegex) {
$AppDeployment = if($Options.Runtime -like 'fxdependent*' -and $Options.Runtime -notmatch $optimizedFddRegex) {
# Global and zip files
"FxDependent"
}
@@ -612,6 +624,12 @@ Fix steps:
}
$Arguments += "/property:AppDeployment=$AppDeployment"
if ($ForMinimalSize) {
# Skip Ready-to-Run compilation in 'PowerShell.Common.props' to keep binary size smaller
$Arguments += "/property:ForMinimalSize=True"
}
$Arguments += "--configuration", $Options.Configuration
$Arguments += "--framework", $Options.Framework
File diff suppressed because it is too large. Load diff