From 45bd53dd0960dd98948591e26d0f07b25ae4f7a4 Mon Sep 17 00:00:00 2001 From: Bevan Weiss Date: Mon, 5 Aug 2024 23:48:31 +1000 Subject: [PATCH] Add references to Standard Actions based on Tables that are included in EnsureTables symbols (from Extensions). This should handle dependencies from Extensions back to Standard Actions that are coupled to Standard Tables. --- .../WindowsInstallerStandard.cs | 29 +++++++++++++++++++ .../Bind/SequenceActionsCommand.cs | 15 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs index 971a04165..6eae5d2b4 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs @@ -11,6 +11,7 @@ public static class WindowsInstallerStandard { private static readonly Dictionary standardActionsById; private static readonly HashSet standardActionNames; + private static readonly Dictionary standardActionsByTableName = new Dictionary(); /// /// References: @@ -368,6 +369,26 @@ static WindowsInstallerStandard() standardActionNames = new HashSet(standardActions.Select(a => a.Action)); standardActionsById = standardActions.ToDictionary(a => a.Id.Id); + + // Populate standard actions based on standard table names + standardActionsByTableName.Add("AppId", new[] + { + standardActionsById["AdvertiseExecuteSequence/RegisterClassInfo"], + standardActionsById["InstallExecuteSequence/UnregisterClassInfo"], + standardActionsById["InstallExecuteSequence/RegisterClassInfo"], + }); + standardActionsByTableName.Add("AppSearch", new[] + { + standardActionsById["InstallUISequence/AppSearch"], + standardActionsById["InstallExecuteSequence/AppSearch"], + }); + standardActionsByTableName.Add("BindImage", new[] { standardActionsById["InstallExecuteSequence/BindImage"] }); + standardActionsByTableName.Add("RemoveFile", new[] { standardActionsById["InstallExecuteSequence/RemoveFiles"] }); + standardActionsByTableName.Add("Registry", new[] + { + standardActionsById["InstallExecuteSequence/WriteRegistryValues"], + standardActionsById["InstallExecuteSequence/RemoveRegistryValues"], + }); } /// @@ -457,6 +478,14 @@ public static bool TryGetStandardAction(string sequenceName, string actioname, o return standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction); } + /// + /// Try to get standard actions associated with a table definition. + /// + public static bool TryGetTableAssociatedStandardActions(string tableName, out WixActionSymbol[] standardActions) + { + return standardActionsByTableName.TryGetValue(tableName, out standardActions); + } + /// /// Try to get standard directory name by id. /// diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs index 3cda47aea..d284d9b56 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs @@ -199,6 +199,21 @@ private Dictionary GetRequiredStandardActions() overridableActionSymbols.Add(standardAction.Id.Id, standardAction); } + // Get the Standard Actions associated with EnsureTable symbols. + foreach (var table in this.Section.Symbols.OfType()) + { + if (WindowsInstallerStandard.TryGetTableAssociatedStandardActions(table.Table, out var standardActions)) + { + foreach(var standardAction in standardActions) + { + if (!overridableActionSymbols.ContainsKey(standardAction.Id.Id)) + { + overridableActionSymbols.Add(standardAction.Id.Id, standardAction); + } + } + } + } + return overridableActionSymbols; }