From 34692d57dcc693ec017dda1711f25adbc7759a1c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 22 Dec 2022 01:04:23 -0800 Subject: Correctly schedule custom actions in Merge Modules Fixes 7098 --- .../CreateWindowsInstallerDataFromIRCommand.cs | 2 +- .../CustomActionFixture.cs | 72 ++++++++++++++++++++++ .../TestData/.Data/test.txt | 1 + .../TestData/CustomAction/MsmCustomAction.wxs | 13 ++++ .../TestData/SetProperty/MsmSetProperty.wxs | 12 ++++ 5 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/test.txt create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/MsmCustomAction.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/MsmSetProperty.wxs diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index e634a50e..49ae1256 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs @@ -1136,7 +1136,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind if (SectionType.Module == this.Section.Type) { row[0] = symbol.Action; - if (0 != symbol.Sequence) + if (symbol.Sequence.HasValue && symbol.Sequence.Value != 0) { row[1] = symbol.Sequence; } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs index fea82267..035b0641 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs @@ -64,6 +64,78 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanScheduleCustomActionInModule() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msmPath = Path.Combine(baseFolder, "bin", "test.msm"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "CustomAction", "MsmCustomAction.wxs"), + Path.Combine(folder, "CustomAction", "SimpleCustomAction.wxs"), + "-bindpath", Path.Combine(folder, ".Data"), + "-intermediateFolder", intermediateFolder, + "-o", msmPath + }); + + result.AssertSuccess(); + + var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "ModuleInstallExecuteSequence" }); + WixAssert.CompareLineByLine(new[] + { + "CustomAction:Action1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t1\tBinary1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tEntryPoint1\t", + "ModuleInstallExecuteSequence:Action1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t\tInstallFiles\t1\t", + "ModuleInstallExecuteSequence:CreateFolders\t3700\t\t\t", + "ModuleInstallExecuteSequence:InstallFiles\t4000\t\t\t", + "ModuleInstallExecuteSequence:RemoveFiles\t3500\t\t\t", + "ModuleInstallExecuteSequence:RemoveFolders\t3600\t\t\t" + }, rows); + } + } + + [Fact] + public void CanScheduleSetPropertyInModule() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msmPath = Path.Combine(baseFolder, "bin", "test.msm"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "SetProperty", "MsmSetProperty.wxs"), + "-bindpath", Path.Combine(folder, "SetProperty", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msmPath + }); + + result.AssertSuccess(); + + var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "ModuleInstallExecuteSequence" }); + WixAssert.CompareLineByLine(new[] + { + "CustomAction:SetINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t51\tINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t[INSTALLFOLDER.243FB739_4D05_472F_9CFB_EF6B1017B6DE]\t", + "ModuleInstallExecuteSequence:CostFinalize\t1000\t\t\t", + "ModuleInstallExecuteSequence:CreateFolders\t3700\t\t\t", + "ModuleInstallExecuteSequence:InstallFiles\t4000\t\t\t", + "ModuleInstallExecuteSequence:RemoveFiles\t3500\t\t\t", + "ModuleInstallExecuteSequence:RemoveFolders\t3600\t\t\t","" + + "ModuleInstallExecuteSequence:SetINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t\tCostFinalize\t1\t" + }, rows); + } + } + [Fact] public void PopulatesCustomActionTable() { diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/test.txt new file mode 100644 index 00000000..fb6c6684 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/test.txt @@ -0,0 +1 @@ +This is test.txt in .Data. diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/MsmCustomAction.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/MsmCustomAction.wxs new file mode 100644 index 00000000..3bae1783 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/MsmCustomAction.wxs @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/MsmSetProperty.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/MsmSetProperty.wxs new file mode 100644 index 00000000..156922c2 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/MsmSetProperty.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb