@joebigelow / wix-1 / commits / 168bd779

Fix RemoveFoldersEx query.

Fixes https://github.com/wixtoolset/issues/issues/7236.

Bob Arnson committed Feb 21, 2023 at 14:20 UTC 168bd779a1994d390ee862ff3bd2de1e7d7ea031
7 files changed +63 -8
src/ext/Util/ca/RemoveFoldersEx.cpp
+2 -2
@@ -3,8 +3,8 @@
3 #include "precomp.h"
4
5 LPCWSTR vcsRemoveFolderExQuery =
6 - L"SELECT `Wix4RemoveFolderEx`, `Component_`, `Property`, `InstallMode`, `Wix4RemoveFolderEx`.`Condition`, `Component`.`Attributes`"
7 - L"FROM `Wix4RemoveFolderEx``,`Component` "
6 + L"SELECT `RemoveFolderEx`, `Component_`, `Property`, `InstallMode`, `Wix4RemoveFolderEx`.`Condition`, `Component`.`Attributes` "
7 + L"FROM `Wix4RemoveFolderEx`,`Component` "
8 L"WHERE `Wix4RemoveFolderEx`.`Component_`=`Component`.`Component`";
9 enum eRemoveFolderExQuery { rfqId = 1, rfqComponent, rfqProperty, rfqMode, rfqCondition, rfqComponentAttributes };
10
src/ext/Util/test/WixToolsetTest.Util/TestData/RemoveFolderEx/Module.wxs
+6 -6
@@ -1,13 +1,13 @@
1 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 - <Module Language="1033" Version="1.0.0.0" Id="InternetShortcutModule" Guid="047730a5-30fe-4a62-a520-da9381b8226a">
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 + <Module Language="1033" Version="1.0.0.0" Id="RemoveFolderExModule" Guid="047730a5-30fe-4a62-a520-da9381b8226a">
3 <SummaryInformation Manufacturer="Example Corporation" />
4
5 <ComponentGroupRef Id="ModuleComponents" />
6 </Module>
7
8 <Fragment>
9 - <StandardDirectory Id="ProgramFilesFolder">
10 - <Directory Id="INSTALLFOLDER" Name="MergeModule" />
11 - </StandardDirectory>
12 - </Fragment>
9 + <StandardDirectory Id="ProgramFilesFolder">
10 + <Directory Id="INSTALLFOLDER" Name="MergeModule" />
11 + </StandardDirectory>
12 + </Fragment>
13 </Wix>
src/ext/Util/test/WixToolsetTest.Util/TestData/RemoveFolderExPackage/Package.en-us.wxl new
+9
@@ -0,0 +1,9 @@
1 +<!--
2 +This file contains the declaration of all the localizable strings.
3 +-->
4 +<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
5 +
6 + <String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
7 + <String Id="FeatureTitle" Value="MsiPackage" />
8 +
9 +</WixLocalization>
src/ext/Util/test/WixToolsetTest.Util/TestData/RemoveFolderExPackage/Package.wxs new
+19
@@ -0,0 +1,19 @@
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 + <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 + <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
4 +
5 + <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
6 + <ComponentGroupRef Id="ProductComponents" />
7 + </Feature>
8 +
9 + <Property Id="REMOVEPROP">
10 + <RegistrySearch Id="GetInstallFolderForNukingPurposes" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="InstallFolder" Type="directory" />
11 + </Property>
12 + </Package>
13 +
14 + <Fragment>
15 + <StandardDirectory Id="ProgramFilesFolder">
16 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
17 + </StandardDirectory>
18 + </Fragment>
19 +</Wix>
src/ext/Util/test/WixToolsetTest.Util/TestData/RemoveFolderExPackage/PackageComponents.wxs new
+11
@@ -0,0 +1,11 @@
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 + <Fragment>
3 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
4 + <Component>
5 + <File Source="example.txt" />
6 + <RegistryValue Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="InstallFolder" Value="[INSTALLFOLDER]" />
7 + <util:RemoveFolderEx On="both" Property="REMOVEPROP" />
8 + </Component>
9 + </ComponentGroup>
10 + </Fragment>
11 +</Wix>
src/ext/Util/test/WixToolsetTest.Util/TestData/RemoveFolderExPackage/example.txt new
+1
@@ -0,0 +1 @@
1 +This is example.txt.
\ No newline at end of file
src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+15
@@ -182,6 +182,21 @@ namespace WixToolsetTest.Util
182 }, results.OrderBy(s => s).ToArray());
183 }
184
185 + [Fact]
186 + public void CanBuildRemoveFolderExInPackage()
187 + {
188 + var folder = TestData.Get(@"TestData\RemoveFolderExPackage");
189 + var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder });
190 +
191 + var results = build.BuildAndQuery(BuildX64, "Binary", "CustomAction", "RemoveFile", "Wix4RemoveFolderEx");
192 + WixAssert.CompareLineByLine(new[]
193 + {
194 + "Binary:Wix4UtilCA_X64\t[Binary data]",
195 + "CustomAction:Wix4RemoveFoldersEx_X64\t65\tWix4UtilCA_X64\tWixRemoveFoldersEx\t",
196 + "Wix4RemoveFolderEx:wrfRwBJnGq1p9zdOKI6qUQ.p.wHFtE\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tREMOVEPROP\t3\t",
197 + }, results.OrderBy(s => s).ToArray());
198 + }
199 +
200 [Fact]
201 public void CanBuildServiceConfig()
202 {