@joebigelow / wix-1 / commits / 6f644be2

Avoid setting null MinValues when removing rows.

- Fixes https://github.com/wixtoolset/issues/issues/8689

Bob Arnson committed Aug 31, 2024 at 23:11 UTC 6f644be25a7981c61d6a91977f5f82a849beb60e
4 files changed +55 -1
src/wix/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs
+1 -1
@@ -268,7 +268,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
268 {
269 if (ColumnType.Number == field.Column.Type && !field.Column.IsLocalizable)
270 {
271 - field.Data = field.Column.MinValue;
271 + field.Data = field.Column.MinValue ?? 0;
272 }
273 else if (ColumnType.Object == field.Column.Type)
274 {
src/wix/test/WixToolsetTest.CoreIntegration/PatchFixture.cs
+21
@@ -336,6 +336,27 @@ namespace WixToolsetTest.CoreIntegration
336 }
337 }
338
339 + [Fact]
340 + public void CanBuildPatchFromProductWithAddedRemoveFileRows()
341 + {
342 + var sourceFolder = TestData.Get(@"TestData", "PatchWithRemovedRemoveFileRows");
343 +
344 + using (var fs = new DisposableFileSystem())
345 + {
346 + var baseFolder = fs.GetFolder();
347 + var tempFolderBaseline = Path.Combine(baseFolder, "baseline");
348 + var tempFolderUpdate = Path.Combine(baseFolder, "update");
349 + var tempFolderPatch = Path.Combine(baseFolder, "patch");
350 +
351 + var baselinePath = BuildMsi("Baseline.msi", sourceFolder, tempFolderBaseline, "1.0.0", "1.0.0", "1.0.0");
352 + var updatePath = BuildMsi("Update.msi", sourceFolder, tempFolderUpdate, "1.0.1", "1.0.1", "1.0.1");
353 + var patchPath = BuildMsp("Patch1.msp", sourceFolder, tempFolderPatch, "1.0.1", bindpaths: new[] { Path.GetDirectoryName(baselinePath), Path.GetDirectoryName(updatePath) }, hasNoFiles: true);
354 +
355 + var doc = GetExtractPatchXml(patchPath);
356 + WixAssert.StringEqual("{6CB58995-A174-4A21-823E-3A114A81AB66}", doc.Root.Element(TargetProductCodeName).Value);
357 + }
358 + }
359 +
360 [Fact]
361 public void CanBuildBundleWithNonSpecificPatches()
362 {
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithRemovedRemoveFileRows/Package.wxs new
+18
@@ -0,0 +1,18 @@
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 + <Package Name="~Test Package" Version="$(V)" Manufacturer="Example Corporation" Language="1033" UpgradeCode="{81CB1126-5796-4012-AB4D-97360EB817F1}" Scope="perMachine" ProductCode="{6CB58995-A174-4A21-823E-3A114A81AB66}">
3 +
4 + <Component Directory="INSTALLFOLDER">
5 + <RegistryValue Root="HKLM" Key="SOFTWARE\WiX Toolset\PatchTests" Name="GonnaRemoveRemoveFileRow" Value="1" KeyPath="yes" />
6 +
7 + <?if $(V) = "1.0.0" ?>
8 + <RemoveFile Name="bar.dat" On="uninstall" />
9 + <?endif?>
10 + </Component>
11 +
12 + <Component Directory="INSTALLFOLDER">
13 + <RegistryValue Root="HKLM" Key="SOFTWARE\WiX Toolset\PatchTests" Name="ButNotInThisComponent" Value="1" KeyPath="yes" />
14 +
15 + <RemoveFile Name="foo.dat" On="uninstall" />
16 + </Component>
17 + </Package>
18 +</Wix>
src/wix/test/WixToolsetTest.CoreIntegration/TestData/PatchWithRemovedRemoveFileRows/Patch.wxs new
+15
@@ -0,0 +1,15 @@
1 +<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>
2 + <Patch
3 + DisplayName="~Test Patch v$(V)"
4 + Description="~Test Small Update Patch v$(V)"
5 + MoreInfoURL="http://www.example.com/"
6 + Manufacturer="Example Corporation"
7 + Classification="Update">
8 +
9 + <Media Id="1" Cabinet="foo.cab">
10 + <PatchBaseline Id="RTM" BaselineFile="Baseline.wixpdb" UpdateFile="Update.wixpdb" />
11 + </Media>
12 +
13 + <PatchFamily Id='SequenceFamily' Version='$(V)' />
14 + </Patch>
15 +</Wix>