From 872f9fbbca4731c1ca38fc0467f4593b5a32dea8 Mon Sep 17 00:00:00 2001 From: Muhammad Danish <88161975+mdanish-kh@users.noreply.github.com> Date: Wed, 1 Jan 2025 01:13:24 +0500 Subject: [PATCH] Don't set ARP entries in NewCommand flow --- src/WingetCreateCLI/Commands/NewCommand.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/WingetCreateCLI/Commands/NewCommand.cs b/src/WingetCreateCLI/Commands/NewCommand.cs index 0a0b12be..06d5dd8d 100644 --- a/src/WingetCreateCLI/Commands/NewCommand.cs +++ b/src/WingetCreateCLI/Commands/NewCommand.cs @@ -195,6 +195,10 @@ public override async Task Execute() try { PackageParser.ParsePackages(installerUpdateList, manifests); + + // The CLI parses ARP entries uses them in update flow to update existing AppsAndFeaturesEntries in the manifest. + // AppsAndFeaturesEntries should not be set for a new package as they may cause more harm than good. + RemoveARPEntries(manifests.InstallerManifest); DisplayArchitectureWarnings(installerUpdateList); } catch (IOException iOException) when (iOException.HResult == -2147024671) @@ -508,6 +512,15 @@ private static void MergeNestedInstallerFilesIfApplicable(InstallerManifest inst } } + private static void RemoveARPEntries(InstallerManifest installerManifest) + { + installerManifest.AppsAndFeaturesEntries = null; + foreach (var installer in installerManifest.Installers) + { + installer.AppsAndFeaturesEntries = null; + } + } + /// /// Prompts for the package identifier and applies the value to all manifests. ///