diff options
author | Bob Arnson <bob@firegiant.com> | 2023-04-20 18:23:07 -0400 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2023-06-03 01:24:39 -0700 |
commit | 846165622978edbea0f5cf58c32f35bc6bfe2906 (patch) | |
tree | acc5e89bf733347e227cf67bb1d6b7ac9d7e0f22 | |
parent | 005a33a0d5ef8233f9d547fa28ae7f72731cad69 (diff) | |
download | wix-846165622978edbea0f5cf58c32f35bc6bfe2906.tar.gz wix-846165622978edbea0f5cf58c32f35bc6bfe2906.tar.bz2 wix-846165622978edbea0f5cf58c32f35bc6bfe2906.zip |
Fix merged ProductCode from mergemod.cub and...
...work around other bugs in mergemod.cub.
Fixes https://github.com/wixtoolset/issues/issues/7413.
7 files changed, 86 insertions, 54 deletions
diff --git a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs index 4c1a3952..7978304a 100644 --- a/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs +++ b/src/wix/WixToolset.Core.Native/WindowsInstallerValidator.cs | |||
@@ -190,14 +190,17 @@ namespace WixToolset.Core.Native | |||
190 | 190 | ||
191 | using (var session = new Session(database)) | 191 | using (var session = new Session(database)) |
192 | { | 192 | { |
193 | // Add the product code back into the database. | 193 | // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. |
194 | if (null != productCode) | 194 | if (propertyTableExists) |
195 | { | 195 | { |
196 | // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. | ||
197 | using (var dropProductCodeView = database.OpenExecuteView("DELETE FROM `Property` WHERE `Property` = 'ProductCode'")) | 196 | using (var dropProductCodeView = database.OpenExecuteView("DELETE FROM `Property` WHERE `Property` = 'ProductCode'")) |
198 | { | 197 | { |
199 | } | 198 | } |
199 | } | ||
200 | 200 | ||
201 | // Add the product code back into the database. | ||
202 | if (null != productCode) | ||
203 | { | ||
201 | using (var view = database.OpenExecuteView($"INSERT INTO `Property` (`Property`, `Value`) VALUES ('ProductCode', '{productCode}')")) | 204 | using (var view = database.OpenExecuteView($"INSERT INTO `Property` (`Property`, `Value`) VALUES ('ProductCode', '{productCode}')")) |
202 | { | 205 | { |
203 | } | 206 | } |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs index 86212c99..a9f03171 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Validate/ValidateDatabaseCommand.cs | |||
@@ -102,6 +102,16 @@ namespace WixToolset.Core.WindowsInstaller.Validate | |||
102 | messageSourceLineNumbers = this.GetSourceLineNumbers(message.Table, message.PrimaryKeys); | 102 | messageSourceLineNumbers = this.GetSourceLineNumbers(message.Table, message.PrimaryKeys); |
103 | } | 103 | } |
104 | 104 | ||
105 | // Sigh. These are bad messages we get from the poorly-built mergemod.cub that supports Arm64. | ||
106 | // TODO: Re-evaluate mergemod.cub that's current for the next version of WiX. | ||
107 | if (message.IceName == "ICE03" | ||
108 | && (message.Table == "File" && message.Description.Contains("_ICEM07CAB Missing specifications")) | ||
109 | || (message.Table == "Component" && message.Description.Contains("_IceM05Mark Missing specifications")) | ||
110 | ) | ||
111 | { | ||
112 | return; | ||
113 | } | ||
114 | |||
105 | switch (message.Type) | 115 | switch (message.Type) |
106 | { | 116 | { |
107 | case ValidationMessageType.InternalFailure: | 117 | case ValidationMessageType.InternalFailure: |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj deleted file mode 100644 index 597d4318..00000000 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <PropertyGroup> | ||
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
5 | <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
6 | <ProductVersion>0.9</ProductVersion> | ||
7 | <ProjectGuid>27df04c6-3cef-4b9a-bac6-4e78d188384f</ProjectGuid> | ||
8 | <OutputName>MergeModule1</OutputName> | ||
9 | <OutputType>Module</OutputType> | ||
10 | <Name>MergeModule1</Name> | ||
11 | <RootNamespace>MergeModule1</RootNamespace> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
14 | <PlatformName>$(Platform)</PlatformName> | ||
15 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
16 | <DefineConstants>Debug</DefineConstants> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
19 | <PlatformName>$(Platform)</PlatformName> | ||
20 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> | ||
23 | <PlatformName>$(Platform)</PlatformName> | ||
24 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
25 | <DefineConstants>Debug</DefineConstants> | ||
26 | </PropertyGroup> | ||
27 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> | ||
28 | <PlatformName>$(Platform)</PlatformName> | ||
29 | <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath> | ||
30 | </PropertyGroup> | ||
31 | <ItemGroup> | ||
32 | <Compile Include="MergeModule.wxs" /> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <EmbeddedResource Include="MergeModule.en-us.wxl" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <WixExtension Include="FgwepExtension.wixext"> | ||
39 | <Name>FgwepExtension.wixext</Name> | ||
40 | <HintPath>$(WixExtDir)\FgwepExtension.wixext.dll</HintPath> | ||
41 | </WixExtension> | ||
42 | </ItemGroup> | ||
43 | <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> | ||
44 | <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " /> | ||
45 | <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> | ||
46 | <Error Text="FG-WiX or WiX Toolset build tools (v3.11 or later) must be installed to build this project. To download FG-WiX, go to https://www.firegiant.com/downloads/. To download the WiX Toolset, go to http://wixtoolset.org/releases/." /> | ||
47 | </Target> | ||
48 | </Project> \ No newline at end of file | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl new file mode 100644 index 00000000..1b7195ad --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | This file contains the declaration of all the localizable strings. | ||
5 | --> | ||
6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
7 | |||
8 | <String Id="Manufacturer" Value="Example Company" /> | ||
9 | |||
10 | </WixLocalization> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs new file mode 100644 index 00000000..fbff36bc --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs | |||
@@ -0,0 +1,19 @@ | |||
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 | <SummaryInformation Manufacturer="!(loc.Manufacturer)" /> | ||
4 | |||
5 | <Property Id="MERGEMODULEPROPERTY" Value="1" /> | ||
6 | |||
7 | <Directory Id="MergeRedirectFolder"> | ||
8 | <Component Id="ModuleComponent1" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | ||
9 | <File Id="File1" Name="file1.txt" Source="test.txt" /> | ||
10 | </Component> | ||
11 | </Directory> | ||
12 | |||
13 | <Directory Id="NotTheMergeRedirectFolder"> | ||
14 | <Component Id="ModuleComponent2" Guid="EADB3047-BD32-417B-AABF-B8D9CCDC22DA"> | ||
15 | <File Id="File2" Name="file2.txt" Source="test.txt" /> | ||
16 | </Component> | ||
17 | </Directory> | ||
18 | </Module> | ||
19 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt | |||
@@ -0,0 +1 @@ | |||
This is test.txt. \ No newline at end of file | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs index babe58f5..aa901b46 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/ValidationFixture.cs | |||
@@ -35,6 +35,7 @@ namespace WixToolsetTest.CoreIntegration | |||
35 | var result = WixRunner.Execute(new[] | 35 | var result = WixRunner.Execute(new[] |
36 | { | 36 | { |
37 | "build", | 37 | "build", |
38 | "-arch", "arm64", | ||
38 | Path.Combine(folder, "Module.wxs"), | 39 | Path.Combine(folder, "Module.wxs"), |
39 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | 40 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), |
40 | "-bindpath", Path.Combine(folder, "data"), | 41 | "-bindpath", Path.Combine(folder, "data"), |
@@ -91,7 +92,7 @@ namespace WixToolsetTest.CoreIntegration | |||
91 | "_SummaryInformation:Author\tExample Company", | 92 | "_SummaryInformation:Author\tExample Company", |
92 | "_SummaryInformation:Keywords\tMergeModule, MSI, database", | 93 | "_SummaryInformation:Keywords\tMergeModule, MSI, database", |
93 | "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install MergeModule1.", | 94 | "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install MergeModule1.", |
94 | "_SummaryInformation:Template\tIntel;1033", | 95 | "_SummaryInformation:Template\tArm64;1033", |
95 | "_SummaryInformation:CodePage\t1252", | 96 | "_SummaryInformation:CodePage\t1252", |
96 | "_SummaryInformation:PageCount\t500", | 97 | "_SummaryInformation:PageCount\t500", |
97 | "_SummaryInformation:WordCount\t0", | 98 | "_SummaryInformation:WordCount\t0", |
@@ -110,6 +111,42 @@ namespace WixToolsetTest.CoreIntegration | |||
110 | } | 111 | } |
111 | 112 | ||
112 | [Fact] | 113 | [Fact] |
114 | public void CanBuildAndValidateSimpleModuleWithProperty() | ||
115 | { | ||
116 | var folder = TestData.Get(@"TestData\SimpleModuleWithProperty"); | ||
117 | |||
118 | using (var fs = new DisposableFileSystem()) | ||
119 | { | ||
120 | var intermediateFolder = fs.GetFolder(); | ||
121 | |||
122 | var result = WixRunner.Execute(new[] | ||
123 | { | ||
124 | "build", | ||
125 | "-arch", "arm64", | ||
126 | Path.Combine(folder, "Module.wxs"), | ||
127 | "-loc", Path.Combine(folder, "Module.en-us.wxl"), | ||
128 | "-bindpath", Path.Combine(folder, "data"), | ||
129 | "-intermediateFolder", intermediateFolder, | ||
130 | "-o", Path.Combine(intermediateFolder, @"bin\test.msm") | ||
131 | }); | ||
132 | |||
133 | result.AssertSuccess(); | ||
134 | |||
135 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); | ||
136 | Assert.True(File.Exists(msmPath)); | ||
137 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
138 | |||
139 | var validationResult = WixRunner.Execute(new[] | ||
140 | { | ||
141 | "msi", "validate", | ||
142 | "-intermediateFolder", intermediateFolder, | ||
143 | msmPath | ||
144 | }); | ||
145 | validationResult.AssertSuccess(); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | [Fact] | ||
113 | public void CanMergeModuleAndValidate() | 150 | public void CanMergeModuleAndValidate() |
114 | { | 151 | { |
115 | var msmFolder = TestData.Get(@"TestData\SimpleModule"); | 152 | var msmFolder = TestData.Get(@"TestData\SimpleModule"); |
@@ -342,14 +379,14 @@ namespace WixToolsetTest.CoreIntegration | |||
342 | msiPath | 379 | msiPath |
343 | }); | 380 | }); |
344 | 381 | ||
345 | Assert.Equal(1076, validationResult.ExitCode); | ||
346 | |||
347 | var messages = validationResult.Messages.Select(m => m.ToString()).ToArray(); | 382 | var messages = validationResult.Messages.Select(m => m.ToString()).ToArray(); |
348 | WixAssert.CompareLineByLine(new[] | 383 | WixAssert.CompareLineByLine(new[] |
349 | { | 384 | { |
350 | "ICE12: CustomAction: CausesICE12Error is of type: 35. Therefore it must come after CostFinalize @ 1000 in Seq Table: InstallExecuteSequence. CA Seq#: 49", | 385 | "ICE12: CustomAction: CausesICE12Error is of type: 35. Therefore it must come after CostFinalize @ 1000 in Seq Table: InstallExecuteSequence. CA Seq#: 49", |
351 | "ICE46: Property 'Myproperty' referenced in column 'LaunchCondition'.'Condition' of row 'Myproperty' differs from a defined property by case only.", | 386 | "ICE46: Property 'Myproperty' referenced in column 'LaunchCondition'.'Condition' of row 'Myproperty' differs from a defined property by case only.", |
352 | }, messages); | 387 | }, messages); |
388 | |||
389 | Assert.Equal(1076, validationResult.ExitCode); | ||
353 | } | 390 | } |
354 | } | 391 | } |
355 | 392 | ||