aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-12-22 01:04:23 -0800
committerRob Mensching <rob@firegiant.com>2022-12-22 01:52:49 -0800
commit34692d57dcc693ec017dda1711f25adbc7759a1c (patch)
tree6448a0245c3c35cafa80d5e41d8bf6e055519d8f /src
parent6bc32281a99bea30541f77dd0bf9e9658753afdc (diff)
downloadwix-34692d57dcc693ec017dda1711f25adbc7759a1c.tar.gz
wix-34692d57dcc693ec017dda1711f25adbc7759a1c.tar.bz2
wix-34692d57dcc693ec017dda1711f25adbc7759a1c.zip
Correctly schedule custom actions in Merge Modules
Fixes 7098
Diffstat (limited to 'src')
-rw-r--r--src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs2
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/CustomActionFixture.cs72
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/.Data/test.txt1
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/MsmCustomAction.wxs13
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/SetProperty/MsmSetProperty.wxs12
5 files changed, 99 insertions, 1 deletions
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
1136 if (SectionType.Module == this.Section.Type) 1136 if (SectionType.Module == this.Section.Type)
1137 { 1137 {
1138 row[0] = symbol.Action; 1138 row[0] = symbol.Action;
1139 if (0 != symbol.Sequence) 1139 if (symbol.Sequence.HasValue && symbol.Sequence.Value != 0)
1140 { 1140 {
1141 row[1] = symbol.Sequence; 1141 row[1] = symbol.Sequence;
1142 } 1142 }
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
@@ -65,6 +65,78 @@ namespace WixToolsetTest.CoreIntegration
65 } 65 }
66 66
67 [Fact] 67 [Fact]
68 public void CanScheduleCustomActionInModule()
69 {
70 var folder = TestData.Get(@"TestData");
71
72 using (var fs = new DisposableFileSystem())
73 {
74 var baseFolder = fs.GetFolder();
75 var intermediateFolder = Path.Combine(baseFolder, "obj");
76 var msmPath = Path.Combine(baseFolder, "bin", "test.msm");
77
78 var result = WixRunner.Execute(new[]
79 {
80 "build",
81 Path.Combine(folder, "CustomAction", "MsmCustomAction.wxs"),
82 Path.Combine(folder, "CustomAction", "SimpleCustomAction.wxs"),
83 "-bindpath", Path.Combine(folder, ".Data"),
84 "-intermediateFolder", intermediateFolder,
85 "-o", msmPath
86 });
87
88 result.AssertSuccess();
89
90 var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "ModuleInstallExecuteSequence" });
91 WixAssert.CompareLineByLine(new[]
92 {
93 "CustomAction:Action1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t1\tBinary1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tEntryPoint1\t",
94 "ModuleInstallExecuteSequence:Action1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t\tInstallFiles\t1\t",
95 "ModuleInstallExecuteSequence:CreateFolders\t3700\t\t\t",
96 "ModuleInstallExecuteSequence:InstallFiles\t4000\t\t\t",
97 "ModuleInstallExecuteSequence:RemoveFiles\t3500\t\t\t",
98 "ModuleInstallExecuteSequence:RemoveFolders\t3600\t\t\t"
99 }, rows);
100 }
101 }
102
103 [Fact]
104 public void CanScheduleSetPropertyInModule()
105 {
106 var folder = TestData.Get(@"TestData");
107
108 using (var fs = new DisposableFileSystem())
109 {
110 var baseFolder = fs.GetFolder();
111 var intermediateFolder = Path.Combine(baseFolder, "obj");
112 var msmPath = Path.Combine(baseFolder, "bin", "test.msm");
113
114 var result = WixRunner.Execute(new[]
115 {
116 "build",
117 Path.Combine(folder, "SetProperty", "MsmSetProperty.wxs"),
118 "-bindpath", Path.Combine(folder, "SetProperty", "data"),
119 "-intermediateFolder", intermediateFolder,
120 "-o", msmPath
121 });
122
123 result.AssertSuccess();
124
125 var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "ModuleInstallExecuteSequence" });
126 WixAssert.CompareLineByLine(new[]
127 {
128 "CustomAction:SetINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t51\tINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t[INSTALLFOLDER.243FB739_4D05_472F_9CFB_EF6B1017B6DE]\t",
129 "ModuleInstallExecuteSequence:CostFinalize\t1000\t\t\t",
130 "ModuleInstallExecuteSequence:CreateFolders\t3700\t\t\t",
131 "ModuleInstallExecuteSequence:InstallFiles\t4000\t\t\t",
132 "ModuleInstallExecuteSequence:RemoveFiles\t3500\t\t\t",
133 "ModuleInstallExecuteSequence:RemoveFolders\t3600\t\t\t","" +
134 "ModuleInstallExecuteSequence:SetINSTALLLOCATION.243FB739_4D05_472F_9CFB_EF6B1017B6DE\t\tCostFinalize\t1\t"
135 }, rows);
136 }
137 }
138
139 [Fact]
68 public void PopulatesCustomActionTable() 140 public void PopulatesCustomActionTable()
69 { 141 {
70 var folder = TestData.Get(@"TestData"); 142 var folder = TestData.Get(@"TestData");
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 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Module Id="MergeModule1" Language="1033" Version="1.0.0.0" Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE">
3 <ComponentGroupRef Id="ProductComponents" />
4 </Module>
5
6 <Fragment>
7 <ComponentGroup Id="MinimalComponentGroup" Directory="TARGETDIR">
8 <Component Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE">
9 <File Source="test.txt" />
10 </Component>
11 </ComponentGroup>
12 </Fragment>
13</Wix>
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 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Module Id="MergeModule1" Language="1033" Version="1.0.0.0" Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE">
3
4 <Directory Id="InstallFolder">
5 <Component Guid="243FB739-4D05-472F-9CFB-EF6B1017B6DE">
6 <File Source="test.txt" />
7 </Component>
8 </Directory>
9
10 <SetProperty Id="INSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
11 </Module>
12</Wix>