From e63ca337697d8787cf825fb64e21d4f58af2cbe2 Mon Sep 17 00:00:00 2001 From: Leilei Zhang Date: Wed, 15 Oct 2025 09:52:37 +0800 Subject: [PATCH] fix build error --- src/PackageIdentity/BuildSparsePackage.ps1 | 15 ++++++++++++--- src/PackageIdentity/PackageIdentity.vcxproj | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) 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 + -