diff --git a/src/PackageIdentity/BuildSparsePackage.ps1 b/src/PackageIdentity/BuildSparsePackage.ps1
index 99aace3a48..0d93afb4ae 100644
--- a/src/PackageIdentity/BuildSparsePackage.ps1
+++ b/src/PackageIdentity/BuildSparsePackage.ps1
@@ -12,7 +12,8 @@ Param(
[switch]$Clean,
[switch]$ForceCert,
- [switch]$NoSign
+ [switch]$NoSign,
+ [switch]$CIBuild
)
# PowerToys sparse packaging helper.
@@ -21,6 +22,13 @@ Param(
$ErrorActionPreference = 'Stop'
+$isCIBuild = $false
+if ($CIBuild.IsPresent) {
+ $isCIBuild = $true
+} elseif ($env:CIBuild) {
+ $isCIBuild = $env:CIBuild -ieq 'true'
+}
+
# Configuration constants - centralized management
$script:Config = @{
IdentityName = "Microsoft.PowerToys.SparseApp"
@@ -239,7 +247,8 @@ if ($versionCandidate) {
# Find MakeAppx.exe from Windows SDK
try {
- $makeAppxPath = Find-WindowsSDKTool -ToolName "makeappx.exe" -Architecture $Platform
+ $hostSdkArchitecture = if ([System.Environment]::Is64BitProcess) { 'x64' } else { 'x86' }
+ $makeAppxPath = Find-WindowsSDKTool -ToolName "makeappx.exe" -Architecture $hostSdkArchitecture
} catch {
Write-Error "MakeAppx.exe not found. Please ensure Windows SDK is installed."
exit 1
@@ -304,7 +313,7 @@ try {
# Ensure publisher matches the dev certificate for local builds
$manifestStagingPath = Join-Path $stagingDir 'AppxManifest.xml'
- $shouldUseDevPublisher = $env:CIBuild -ne 'true'
+ $shouldUseDevPublisher = -not $isCIBuild
if (Test-Path $manifestStagingPath) {
try {
[xml]$manifestXml = Get-Content -Path $manifestStagingPath -Raw
diff --git a/src/PackageIdentity/PackageIdentity.vcxproj b/src/PackageIdentity/PackageIdentity.vcxproj
index 406b73d085..bdfa627a11 100644
--- a/src/PackageIdentity/PackageIdentity.vcxproj
+++ b/src/PackageIdentity/PackageIdentity.vcxproj
@@ -13,9 +13,11 @@
-NoSign
+ -CIBuild
+
-