diff options
author | Rob Mensching <rob@firegiant.com> | 2023-08-07 15:43:10 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2023-08-08 09:00:26 -0700 |
commit | 205215078d3b7bd9c7459307bc792d52ec404760 (patch) | |
tree | 208b1b33bf7d910f5f40ee42a59704ab528afe86 | |
parent | 1ef2fac522e39384fd8379256b9ce9ef750e18c9 (diff) | |
download | wix-205215078d3b7bd9c7459307bc792d52ec404760.tar.gz wix-205215078d3b7bd9c7459307bc792d52ec404760.tar.bz2 wix-205215078d3b7bd9c7459307bc792d52ec404760.zip |
Fix the use of ModuleSubstitution table
Addresses two issues in the creation of configurable merge modules. First, the
ModuleConfiguration table Id should not be modularized. Second, the
ModuleSubstitution table was never created. Fixing both of those allows
configurable merge modules to work again.
Fixes 7559
6 files changed, 93 insertions, 3 deletions
diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs index b0fde6a7..9f0cdd96 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerTableDefinitions.cs | |||
@@ -1455,7 +1455,7 @@ namespace WixToolset.Data.WindowsInstaller | |||
1455 | SymbolDefinitions.ModuleConfiguration, | 1455 | SymbolDefinitions.ModuleConfiguration, |
1456 | new[] | 1456 | new[] |
1457 | { | 1457 | { |
1458 | new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Unique identifier for this row."), | 1458 | new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "Unique identifier for this row.", modularizeType: ColumnModularizeType.None), |
1459 | new ColumnDefinition("Format", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 0, maxValue: 3, description: "Format of this item."), | 1459 | new ColumnDefinition("Format", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, minValue: 0, maxValue: 3, description: "Format of this item."), |
1460 | new ColumnDefinition("Type", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional type information for this item."), | 1460 | new ColumnDefinition("Type", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional type information for this item."), |
1461 | new ColumnDefinition("ContextData", ColumnType.Localized, 0, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional context information about this item."), | 1461 | new ColumnDefinition("ContextData", ColumnType.Localized, 0, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Additional context information about this item."), |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index a1ec24f4..4db1bfbe 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
@@ -58,7 +58,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
58 | 58 | ||
59 | private IWindowsInstallerBackendHelper WindowsInstallerBackendHelper { get; } | 59 | private IWindowsInstallerBackendHelper WindowsInstallerBackendHelper { get; } |
60 | 60 | ||
61 | private IFileSystem FileSystem { get; } | 61 | private IFileSystem FileSystem { get; } |
62 | 62 | ||
63 | private IPathResolver PathResolver { get; } | 63 | private IPathResolver PathResolver { get; } |
64 | 64 | ||
@@ -477,7 +477,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
477 | var command = new MergeModulesCommand(this.Messaging, this.WindowsInstallerBackendHelper, fileFacadesFromModule, section, suppressedTableNames, this.OutputPath, this.IntermediateFolder); | 477 | var command = new MergeModulesCommand(this.Messaging, this.WindowsInstallerBackendHelper, fileFacadesFromModule, section, suppressedTableNames, this.OutputPath, this.IntermediateFolder); |
478 | command.Execute(); | 478 | command.Execute(); |
479 | 479 | ||
480 | trackedFiles.AddRange(command.TrackedFiles); | 480 | if (command.TrackedFiles != null) |
481 | { | ||
482 | trackedFiles.AddRange(command.TrackedFiles); | ||
483 | } | ||
481 | } | 484 | } |
482 | 485 | ||
483 | if (this.Messaging.EncounteredError) | 486 | if (this.Messaging.EncounteredError) |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index 18914745..234cad4a 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs | |||
@@ -148,6 +148,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
148 | break; | 148 | break; |
149 | 149 | ||
150 | case SymbolDefinitionType.ModuleSubstitution: | 150 | case SymbolDefinitionType.ModuleSubstitution: |
151 | this.AddSymbolDefaultly(symbol); | ||
151 | this.EnsureModuleIgnoredTable(symbol, "ModuleSubstitution"); | 152 | this.EnsureModuleIgnoredTable(symbol, "ModuleSubstitution"); |
152 | break; | 153 | break; |
153 | 154 | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs index eadc70aa..3e42431e 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/ModuleFixture.cs | |||
@@ -14,6 +14,64 @@ namespace WixToolsetTest.CoreIntegration | |||
14 | public class ModuleFixture | 14 | public class ModuleFixture |
15 | { | 15 | { |
16 | [Fact] | 16 | [Fact] |
17 | public void CanBuildAndMergeModuleWithSubstitution() | ||
18 | { | ||
19 | var folder = TestData.Get(@"TestData", "Module"); | ||
20 | |||
21 | using (var fs = new DisposableFileSystem()) | ||
22 | { | ||
23 | var intermediateFolder = fs.GetFolder(); | ||
24 | var msmIntermediatePath = Path.Combine(intermediateFolder, "msm"); | ||
25 | var msmPath = Path.Combine(msmIntermediatePath, "test.msm"); | ||
26 | |||
27 | var msiIntermediatePath = Path.Combine(intermediateFolder, "msi"); | ||
28 | var msiPath = Path.Combine(msiIntermediatePath, "test.msi"); | ||
29 | |||
30 | // Build the MSM. | ||
31 | var result = WixRunner.Execute(new[] | ||
32 | { | ||
33 | "build", | ||
34 | Path.Combine(folder, "ModuleSubstitution.wxs"), | ||
35 | "-intermediateFolder", msmIntermediatePath, | ||
36 | "-sw1079", | ||
37 | "-o", msmPath | ||
38 | }); | ||
39 | |||
40 | result.AssertSuccess(); | ||
41 | |||
42 | // Verify the MSM. | ||
43 | var rows = Query.QueryDatabase(msmPath, new[] { "CustomAction", "ModuleConfiguration", "ModuleSubstitution" }); | ||
44 | WixAssert.CompareLineByLine(new[] | ||
45 | { | ||
46 | "CustomAction:setCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5\t51\tmsmCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5\t[msmCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5]\t", | ||
47 | "ModuleConfiguration:CONFIGTEST\t0\t\t\t\t0\t\t\t\t", | ||
48 | "ModuleSubstitution:CustomAction\tsetCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5\tTarget\t[=CONFIGTEST]" | ||
49 | }, rows); | ||
50 | |||
51 | // Merge the module into an MSI. | ||
52 | result = WixRunner.Execute(new[] | ||
53 | { | ||
54 | "build", | ||
55 | Path.Combine(folder, "MergeModuleSubstitution.wxs"), | ||
56 | "-bindpath", msmIntermediatePath, | ||
57 | "-intermediateFolder", msiIntermediatePath, | ||
58 | "-o", msiPath | ||
59 | }); | ||
60 | |||
61 | result.AssertSuccess(); | ||
62 | |||
63 | // Verify the MSI. | ||
64 | rows = Query.QueryDatabase(msiPath, new[] { "CustomAction", "ModuleConfiguration", "ModuleSubstitution" }); | ||
65 | WixAssert.CompareLineByLine(new[] | ||
66 | { | ||
67 | "CustomAction:setCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5\t51\tmsmCONFIGTEST.DC68E039_E0C8_49FB_B5E6_37F9569188E5\tTestingTesting123\t" | ||
68 | }, rows); | ||
69 | |||
70 | result.AssertSuccess(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | [Fact] | ||
17 | public void CanSuppressModularization() | 75 | public void CanSuppressModularization() |
18 | { | 76 | { |
19 | var folder = TestData.Get(@"TestData\SuppressModularization"); | 77 | var folder = TestData.Get(@"TestData\SuppressModularization"); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/MergeModuleSubstitution.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/MergeModuleSubstitution.wxs new file mode 100644 index 00000000..0afd79b2 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/MergeModuleSubstitution.wxs | |||
@@ -0,0 +1,17 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Package Name="MergeModuleSubstitution" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
3 | <MajorUpgrade DowngradeErrorMessage="Downgrade message" /> | ||
4 | |||
5 | <Feature Id="Main"> | ||
6 | <MergeRef Id="TestMsm" /> | ||
7 | </Feature> | ||
8 | |||
9 | <StandardDirectory Id="ProgramFilesFolder"> | ||
10 | <Directory Id="INSTALLFOLDER" Name="MsiPackage"> | ||
11 | <Merge Id="TestMsm" Language="1033" SourceFile="test.msm"> | ||
12 | <ConfigurationData Name="CONFIGTEST" Value="TestingTesting123" /> | ||
13 | </Merge> | ||
14 | </Directory> | ||
15 | </StandardDirectory> | ||
16 | </Package> | ||
17 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs new file mode 100644 index 00000000..0ada31b9 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Module/ModuleSubstitution.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Module Id="MergeModule.v4" Guid="dc68e039-e0c8-49fb-b5e6-37f9569188e5" Language="1033" Version="1.0.0.0"> | ||
3 | <SummaryInformation Manufacturer="Manufacturer" /> | ||
4 | |||
5 | <Configuration Name='CONFIGTEST' Format='Text'/> | ||
6 | <Substitution Table='CustomAction' Row='setCONFIGTEST' Column='Target' Value='[=CONFIGTEST]'/> | ||
7 | |||
8 | <Property Id="msmCONFIGTEST" Value="failure"/> | ||
9 | <CustomAction Id='setCONFIGTEST' Property='msmCONFIGTEST' Value='[msmCONFIGTEST]'/> | ||
10 | </Module> | ||
11 | </Wix> | ||