From 25fe90253cd3286369b592afbf4c7c72c5a7c34c Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Mon, 5 Jan 2026 12:07:16 -0800 Subject: [PATCH] Regenerate Win32 app JSON for pre-downloaded content Ensures CLI builds properly register silent install commands even when app content already exists and download is skipped. --- .../FFU.Common/FFU.Common.Winget.psm1 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/FFUDevelopment/FFU.Common/FFU.Common.Winget.psm1 b/FFUDevelopment/FFU.Common/FFU.Common.Winget.psm1 index 7f891a6..dff277c 100644 --- a/FFUDevelopment/FFU.Common/FFU.Common.Winget.psm1 +++ b/FFUDevelopment/FFU.Common/FFU.Common.Winget.psm1 @@ -441,6 +441,26 @@ function Start-WingetAppDownloadTask { $status = "Not Downloaded: Existing content found in $appFolder" Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $appId -Status $status WriteLog "Found existing content for '$appName' in '$appFolder'. Skipping download to prevent duplicate entry." + + # Regenerate WinGetWin32Apps.json for CLI builds when content already exists + # UI mode pre-downloads should not generate this file (SkipWin32Json) + if (-not $SkipWin32Json) { + $archFolders = Get-ChildItem -Path $appFolder -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -in @('x86', 'x64', 'arm64') } + if ($archFolders) { + foreach ($archFolder in $archFolders) { + WriteLog "Adding silent install command for pre-downloaded $sanitizedAppName ($($archFolder.Name)) to $OrchestrationPath\WinGetWin32Apps.json" + Add-Win32SilentInstallCommand -AppFolder $sanitizedAppName -AppFolderPath $archFolder.FullName -OrchestrationPath $OrchestrationPath -SubFolder $archFolder.Name | Out-Null + } + } + else { + WriteLog "Adding silent install command for pre-downloaded $sanitizedAppName to $OrchestrationPath\WinGetWin32Apps.json" + Add-Win32SilentInstallCommand -AppFolder $sanitizedAppName -AppFolderPath $appFolder -OrchestrationPath $OrchestrationPath | Out-Null + } + } + else { + WriteLog "Skipping WinGetWin32Apps.json regeneration for pre-downloaded $sanitizedAppName (UI mode)." + } + return [PSCustomObject]@{ Id = $appId; Status = $status; ResultCode = 0 } } }