From 846165622978edbea0f5cf58c32f35bc6bfe2906 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 20 Apr 2023 18:23:07 -0400 Subject: Fix merged ProductCode from mergemod.cub and... ...work around other bugs in mergemod.cub. Fixes https://github.com/wixtoolset/issues/issues/7413. --- .../WindowsInstallerValidator.cs | 9 ++-- .../Validate/ValidateDatabaseCommand.cs | 10 +++++ .../TestData/SimpleModule/Module.wixproj | 48 ---------------------- .../SimpleModuleWithProperty/Module.en-us.wxl | 10 +++++ .../TestData/SimpleModuleWithProperty/Module.wxs | 19 +++++++++ .../SimpleModuleWithProperty/data/test.txt | 1 + .../ValidationFixture.cs | 43 +++++++++++++++++-- 7 files changed, 86 insertions(+), 54 deletions(-) delete mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wixproj create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.en-us.wxl create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/Module.wxs create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModuleWithProperty/data/test.txt 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 using (var session = new Session(database)) { - // Add the product code back into the database. - if (null != productCode) + // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. + if (propertyTableExists) { - // Some CUBs erroneously have a ProductCode property, so delete it if we just picked one up. using (var dropProductCodeView = database.OpenExecuteView("DELETE FROM `Property` WHERE `Property` = 'ProductCode'")) { } + } + // Add the product code back into the database. + if (null != productCode) + { using (var view = database.OpenExecuteView($"INSERT INTO `Property` (`Property`, `Value`) VALUES ('ProductCode', '{productCode}')")) { } 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 messageSourceLineNumbers = this.GetSourceLineNumbers(message.Table, message.PrimaryKeys); } + // Sigh. These are bad messages we get from the poorly-built mergemod.cub that supports Arm64. + // TODO: Re-evaluate mergemod.cub that's current for the next version of WiX. + if (message.IceName == "ICE03" + && (message.Table == "File" && message.Description.Contains("_ICEM07CAB Missing specifications")) + || (message.Table == "Component" && message.Description.Contains("_IceM05Mark Missing specifications")) + ) + { + return; + } + switch (message.Type) { 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 @@ - - - - Debug - x86 - 0.9 - 27df04c6-3cef-4b9a-bac6-4e78d188384f - MergeModule1 - Module - MergeModule1 - MergeModule1 - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - FgwepExtension.wixext - $(WixExtDir)\FgwepExtension.wixext.dll - - - - - - - - \ 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 @@ + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + 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 var result = WixRunner.Execute(new[] { "build", + "-arch", "arm64", Path.Combine(folder, "Module.wxs"), "-loc", Path.Combine(folder, "Module.en-us.wxl"), "-bindpath", Path.Combine(folder, "data"), @@ -91,7 +92,7 @@ namespace WixToolsetTest.CoreIntegration "_SummaryInformation:Author\tExample Company", "_SummaryInformation:Keywords\tMergeModule, MSI, database", "_SummaryInformation:Comments\tThis merge module contains the logic and data required to install MergeModule1.", - "_SummaryInformation:Template\tIntel;1033", + "_SummaryInformation:Template\tArm64;1033", "_SummaryInformation:CodePage\t1252", "_SummaryInformation:PageCount\t500", "_SummaryInformation:WordCount\t0", @@ -109,6 +110,42 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildAndValidateSimpleModuleWithProperty() + { + var folder = TestData.Get(@"TestData\SimpleModuleWithProperty"); + + using (var fs = new DisposableFileSystem()) + { + var intermediateFolder = fs.GetFolder(); + + var result = WixRunner.Execute(new[] + { + "build", + "-arch", "arm64", + Path.Combine(folder, "Module.wxs"), + "-loc", Path.Combine(folder, "Module.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(intermediateFolder, @"bin\test.msm") + }); + + result.AssertSuccess(); + + var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); + Assert.True(File.Exists(msmPath)); + Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); + + var validationResult = WixRunner.Execute(new[] + { + "msi", "validate", + "-intermediateFolder", intermediateFolder, + msmPath + }); + validationResult.AssertSuccess(); + } + } + [Fact] public void CanMergeModuleAndValidate() { @@ -342,14 +379,14 @@ namespace WixToolsetTest.CoreIntegration msiPath }); - Assert.Equal(1076, validationResult.ExitCode); - var messages = validationResult.Messages.Select(m => m.ToString()).ToArray(); WixAssert.CompareLineByLine(new[] { "ICE12: CustomAction: CausesICE12Error is of type: 35. Therefore it must come after CostFinalize @ 1000 in Seq Table: InstallExecuteSequence. CA Seq#: 49", "ICE46: Property 'Myproperty' referenced in column 'LaunchCondition'.'Condition' of row 'Myproperty' differs from a defined property by case only.", }, messages); + + Assert.Equal(1076, validationResult.ExitCode); } } -- cgit v1.2.3-55-g6feb