@joebigelow / wix-1 / commits / 3efe3f3a

Prevent direct references to platform neutral WixUI

Fixes 7265

Rob Mensching committed Mar 9, 2023 at 03:43 UTC 3efe3f3a8682f333741b3c52e10eea2297f43dc9
12 files changed +218 -122
src/ext/UI/test/WixToolsetTest.UI/TestData/InvalidUIRef/Package.wxs new
+23
@@ -0,0 +1,23 @@
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2 + <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200">
3 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
4 +
5 + <Feature Id="ProductFeature" Title="MsiPackage">
6 + <ComponentGroupRef Id="ProductComponents" />
7 + </Feature>
8 +
9 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
10 + <Component>
11 + <File Source="example.txt" />
12 + </Component>
13 + </ComponentGroup>
14 +
15 + <UIRef Id="WixUI_Mondo" />
16 + </Package>
17 +
18 + <Fragment>
19 + <StandardDirectory Id="ProgramFilesFolder">
20 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
21 + </StandardDirectory>
22 + </Fragment>
23 +</Wix>
src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs
+46 -22
@@ -2,11 +2,10 @@
2
3 namespace WixToolsetTest.UI
4 {
5 - using System;
5 using System.IO;
6 using System.Linq;
8 - using WixInternal.TestSupport;
7 using WixInternal.Core.TestPackage;
8 + using WixInternal.TestSupport;
9 using WixToolset.Data.WindowsInstaller;
10 using WixToolset.UI;
11 using Xunit;
@@ -16,8 +15,8 @@ namespace WixToolsetTest.UI
15 [Fact]
16 public void CanBuildUsingWixUIAdvanced()
17 {
19 - var folder = TestData.Get(@"TestData\WixUI_Advanced");
20 - var bindFolder = TestData.Get(@"TestData\data");
18 + var folder = TestData.Get(@"TestData", "WixUI_Advanced");
19 + var bindFolder = TestData.Get(@"TestData", "data");
20 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
21
22 var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -52,8 +51,8 @@ namespace WixToolsetTest.UI
51 [Fact]
52 public void CanBuildUsingWixUIAdvancedX64()
53 {
55 - var folder = TestData.Get(@"TestData\WixUI_Advanced");
56 - var bindFolder = TestData.Get(@"TestData\data");
54 + var folder = TestData.Get(@"TestData", "WixUI_Advanced");
55 + var bindFolder = TestData.Get(@"TestData", "data");
56 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
57
58 var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -88,8 +87,8 @@ namespace WixToolsetTest.UI
87 [Fact]
88 public void CanBuildUsingWixUIAdvancedARM64()
89 {
91 - var folder = TestData.Get(@"TestData\WixUI_Advanced");
92 - var bindFolder = TestData.Get(@"TestData\data");
90 + var folder = TestData.Get(@"TestData", "WixUI_Advanced");
91 + var bindFolder = TestData.Get(@"TestData", "data");
92 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
93
94 var results = build.BuildAndQuery(BuildARM64, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -124,8 +123,8 @@ namespace WixToolsetTest.UI
123 [Fact]
124 public void CanBuildUsingWixUIFeatureTree()
125 {
127 - var folder = TestData.Get(@"TestData\WixUI_FeatureTree");
128 - var bindFolder = TestData.Get(@"TestData\data");
126 + var folder = TestData.Get(@"TestData", "WixUI_FeatureTree");
127 + var bindFolder = TestData.Get(@"TestData", "data");
128 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
129
130 var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -155,8 +154,8 @@ namespace WixToolsetTest.UI
154 [Fact]
155 public void CanBuildUsingWixUIInstallDir()
156 {
158 - var folder = TestData.Get(@"TestData\WixUI_InstallDir");
159 - var bindFolder = TestData.Get(@"TestData\data");
157 + var folder = TestData.Get(@"TestData", "WixUI_InstallDir");
158 + var bindFolder = TestData.Get(@"TestData", "data");
159 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
160
161 var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent");
@@ -191,8 +190,8 @@ namespace WixToolsetTest.UI
190 [Fact]
191 public void CanBuildUsingWixUIMinimal()
192 {
194 - var folder = TestData.Get(@"TestData\WixUI_Minimal");
195 - var bindFolder = TestData.Get(@"TestData\data");
193 + var folder = TestData.Get(@"TestData", "WixUI_Minimal");
194 + var bindFolder = TestData.Get(@"TestData", "data");
195 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
196
197 var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -220,8 +219,8 @@ namespace WixToolsetTest.UI
219 [Fact]
220 public void CanBuildUsingWixUIMinimalInKazakh()
221 {
223 - var folder = TestData.Get(@"TestData\WixUI_Minimal");
224 - var bindFolder = TestData.Get(@"TestData\data");
222 + var folder = TestData.Get(@"TestData", "WixUI_Minimal");
223 + var bindFolder = TestData.Get(@"TestData", "data");
224 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
225
226 var results = build.BuildAndQuery(BuildInKazakh, "Dialog");
@@ -232,8 +231,8 @@ namespace WixToolsetTest.UI
231 [Fact]
232 public void CanBuildUsingWixUIMinimalAndReadPdb()
233 {
235 - var folder = TestData.Get(@"TestData\WixUI_Minimal");
236 - var bindFolder = TestData.Get(@"TestData\data");
234 + var folder = TestData.Get(@"TestData", "WixUI_Minimal");
235 + var bindFolder = TestData.Get(@"TestData", "data");
236
237 using (var fs = new DisposableFileSystem())
238 {
@@ -258,8 +257,8 @@ namespace WixToolsetTest.UI
257 [Fact]
258 public void CanBuildUsingWixUIMondo()
259 {
261 - var folder = TestData.Get(@"TestData\WixUI_Mondo");
262 - var bindFolder = TestData.Get(@"TestData\data");
260 + var folder = TestData.Get(@"TestData", "WixUI_Mondo");
261 + var bindFolder = TestData.Get(@"TestData", "data");
262 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
263
264 var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
@@ -292,8 +291,8 @@ namespace WixToolsetTest.UI
291 [Fact]
292 public void CanBuildUsingWixUIMondoLocalized()
293 {
295 - var folder = TestData.Get(@"TestData\WixUI_Mondo");
296 - var bindFolder = TestData.Get(@"TestData\data");
294 + var folder = TestData.Get(@"TestData", "WixUI_Mondo");
295 + var bindFolder = TestData.Get(@"TestData", "data");
296 var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
297
298 var results = build.BuildAndQuery(BuildInGerman, "Control");
@@ -303,6 +302,31 @@ namespace WixToolsetTest.UI
302 }, results.Where(s => s.StartsWith("Control:ErrorDlg\tY")).Select(s => s.Split('\t')[9]).ToArray());
303 }
304
305 + [Fact]
306 + public void CannotBuildWithV3LikeUIRef()
307 + {
308 + var folder = TestData.Get(@"TestData", "InvalidUIRef");
309 +
310 + using (var fs = new DisposableFileSystem())
311 + {
312 + var intermediateFolder = fs.GetFolder();
313 + var outputPath = Path.Combine(intermediateFolder, "bin", "test.msi");
314 +
315 + var args = new[]
316 + {
317 + "build",
318 + Path.Combine(folder, "Package.wxs"),
319 + "-ext", typeof(UIExtensionFactory).Assembly.Location,
320 + "-intermediateFolder", intermediateFolder,
321 + "-o", outputPath,
322 + };
323 +
324 + var results = WixRunner.Execute(args);
325 + var message = results.Messages.Single();
326 + Assert.Equal("The identifier 'WixUI:WixUI_Mondo' is inaccessible due to its protection level.", message.ToString());
327 + }
328 + }
329 +
330 private static void Build(string[] args)
331 {
332 var result = WixRunner.Execute(args)
src/ext/UI/wixext/UICompiler.cs
-1
@@ -87,7 +87,6 @@ namespace WixToolset.UI
87 else
88 {
89 var platform = this.Context.Platform == Platform.ARM64 ? "A64" : this.Context.Platform.ToString();
90 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixUI, id);
90 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixUI, $"{id}_{platform}");
91
92 if (installDirectory != null)
src/ext/UI/wixlib/WixUI_Advanced.wxs
+13 -13
@@ -1,7 +1,5 @@
1 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3 -
4 -
3 <!--
4 WixUI_Advanced offers a two-click install (EULA checkbox and Install button)
5 and offers an Advanced button that lets users choose per-machine or per-user
@@ -22,6 +20,18 @@ Todo:
20 -->
21
22 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
23 + <?foreach WIXUIARCH in X86;X64;A64 ?>
24 + <Fragment>
25 + <UI Id="WixUI_Advanced_$(WIXUIARCH)">
26 + <Publish Dialog="AdvancedWelcomeEulaDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
27 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" Condition="NOT WIXUI_DONTVALIDATEPATH" />
28 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
29 + </UI>
30 +
31 + <UIRef Id="WixUI_Advanced" />
32 + </Fragment>
33 + <?endforeach?>
34 +
35 <Fragment>
36 <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
37 <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
@@ -46,7 +56,7 @@ Todo:
56 <Custom Action="WixSetPerMachineFolder" After="WixSetPerUserFolder" Condition="ACTION=&quot;INSTALL&quot; AND APPLICATIONFOLDER=&quot;&quot; AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))" />
57 </InstallUISequence>
58
49 - <UI Id="WixUI_Advanced">
59 + <UI Id="file WixUI_Advanced">
60 <TextStyle Id="WixUI_Font_Normal" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Normal_Size)" />
61 <TextStyle Id="WixUI_Font_Bigger" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Bigger_Size)" />
62 <TextStyle Id="WixUI_Font_Title" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Title_Size)" Bold="yes" />
@@ -115,14 +125,4 @@ Todo:
125 <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" />
126 <UIRef Id="WixUI_Common" />
127 </Fragment>
118 -
119 - <?foreach WIXUIARCH in X86;X64;A64 ?>
120 - <Fragment>
121 - <UI Id="WixUI_Advanced_$(WIXUIARCH)">
122 - <Publish Dialog="AdvancedWelcomeEulaDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
123 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" Condition="NOT WIXUI_DONTVALIDATEPATH" />
124 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
125 - </UI>
126 - </Fragment>
127 - <?endforeach?>
128 </Wix>
src/ext/UI/wixlib/WixUI_FeatureTree.wxs
+11 -11
@@ -1,7 +1,5 @@
1 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3 -
4 -
3 <!--
4 First-time install dialog sequence:
5 - WixUI_WelcomeDlg
@@ -22,8 +20,18 @@ Patch dialog sequence:
20 -->
21
22 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
23 + <?foreach WIXUIARCH in X86;X64;A64 ?>
24 <Fragment>
26 - <UI Id="WixUI_FeatureTree">
25 + <UI Id="WixUI_FeatureTree_$(WIXUIARCH)">
26 + <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
27 + </UI>
28 +
29 + <UIRef Id="WixUI_FeatureTree" />
30 + </Fragment>
31 + <?endforeach?>
32 +
33 + <Fragment>
34 + <UI Id="file WixUI_FeatureTree">
35 <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
36 <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
37 <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
@@ -65,12 +73,4 @@ Patch dialog sequence:
73
74 <UIRef Id="WixUI_Common" />
75 </Fragment>
68 -
69 - <?foreach WIXUIARCH in X86;X64;A64 ?>
70 - <Fragment>
71 - <UI Id="WixUI_FeatureTree_$(WIXUIARCH)">
72 - <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
73 - </UI>
74 - </Fragment>
75 - <?endforeach?>
76 </Wix>
src/ext/UI/wixlib/WixUI_InstallDir.wxs
+13 -13
@@ -1,7 +1,5 @@
1 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3 -
4 -
3 <!--
4 First-time install dialog sequence:
5 - WixUI_WelcomeDlg
@@ -23,8 +21,20 @@ Patch dialog sequence:
21 -->
22
23 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
24 + <?foreach WIXUIARCH in X86;X64;A64 ?>
25 <Fragment>
27 - <UI Id="WixUI_InstallDir">
26 + <UI Id="WixUI_InstallDir_$(WIXUIARCH)">
27 + <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
28 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
29 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
30 + </UI>
31 +
32 + <UIRef Id="WixUI_InstallDir" />
33 + </Fragment>
34 + <?endforeach?>
35 +
36 + <Fragment>
37 + <UI Id="file WixUI_InstallDir">
38 <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
39 <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
40 <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
@@ -72,14 +82,4 @@ Patch dialog sequence:
82
83 <UIRef Id="WixUI_Common" />
84 </Fragment>
75 -
76 - <?foreach WIXUIARCH in X86;X64;A64 ?>
77 - <Fragment>
78 - <UI Id="WixUI_InstallDir_$(WIXUIARCH)">
79 - <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
80 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
81 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
82 - </UI>
83 - </Fragment>
84 - <?endforeach?>
85 </Wix>
src/ext/UI/wixlib/WixUI_Minimal.wxs
+11 -11
@@ -1,7 +1,5 @@
1 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3 -
4 -
3 <!--
4 First-time install dialog sequence:
5 - WixUI_WelcomeEulaDlg
@@ -17,8 +15,18 @@ Patch dialog sequence:
15 -->
16
17 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
18 + <?foreach WIXUIARCH in X86;X64;A64 ?>
19 <Fragment>
21 - <UI Id="WixUI_Minimal">
20 + <UI Id="WixUI_Minimal_$(WIXUIARCH)">
21 + <Publish Dialog="WelcomeEulaDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
22 + </UI>
23 +
24 + <UIRef Id="WixUI_Minimal" />
25 + </Fragment>
26 + <?endforeach?>
27 +
28 + <Fragment>
29 + <UI Id="file WixUI_Minimal">
30 <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
31 <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
32 <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
@@ -59,12 +67,4 @@ Patch dialog sequence:
67
68 <UIRef Id="WixUI_Common" />
69 </Fragment>
62 -
63 - <?foreach WIXUIARCH in X86;X64;A64 ?>
64 - <Fragment>
65 - <UI Id="WixUI_Minimal_$(WIXUIARCH)">
66 - <Publish Dialog="WelcomeEulaDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
67 - </UI>
68 - </Fragment>
69 - <?endforeach?>
70 </Wix>
src/ext/UI/wixlib/WixUI_Mondo.wxs
+13 -13
@@ -1,7 +1,5 @@
1 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
3 -
4 -
3 <!--
4 First-time install dialog sequence:
5 - WixUI_WelcomeDlg
@@ -24,8 +22,20 @@ Patch dialog sequence:
22 -->
23
24 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
25 + <?foreach WIXUIARCH in X86;X64;A64 ?>
26 <Fragment>
28 - <UI Id="WixUI_Mondo">
27 + <UI Id="WixUI_Mondo_$(WIXUIARCH)">
28 + <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
29 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
30 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
31 + </UI>
32 +
33 + <UIRef Id="WixUI_Mondo" />
34 + </Fragment>
35 + <?endforeach?>
36 +
37 + <Fragment>
38 + <UI Id="file WixUI_Mondo">
39 <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
40 <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
41 <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
@@ -74,14 +84,4 @@ Patch dialog sequence:
84
85 <UIRef Id="WixUI_Common" />
86 </Fragment>
77 -
78 - <?foreach WIXUIARCH in X86;X64;A64 ?>
79 - <Fragment>
80 - <UI Id="WixUI_Mondo_$(WIXUIARCH)">
81 - <Publish Dialog="LicenseAgreementDlg" Control="Print" Event="DoAction" Value="WixUIPrintEula_$(WIXUIARCH)" />
82 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
83 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
84 - </UI>
85 - </Fragment>
86 - <?endforeach?>
87 </Wix>
src/ext/UI/wixlib/ui.v3.ncrunchproject new
+5
@@ -0,0 +1,5 @@
1 +<ProjectConfiguration>
2 + <Settings>
3 + <IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
4 + </Settings>
5 +</ProjectConfiguration>
\ No newline at end of file
src/wix/WixToolset.Converters/WixConverter.cs
+1 -1
@@ -1687,7 +1687,7 @@ namespace WixToolset.Converters
1687 && value?.StartsWith("WixUI", StringComparison.OrdinalIgnoreCase) == true
1688 && this.OnInformation(ConverterTestType.CustomActionIdsIncludePlatformSuffix, element, "Custom action ids have changed in WiX v4 extensions to support platform-specific custom actions. For more information, see https://wixtoolset.org/docs/fourthree/#converting-custom-wixui-dialog-sets."))
1689 {
1690 - // Just warn.
1690 + element.Attribute("Value").Value = value + "_$(sys.BUILDARCHSHORT)";
1691 }
1692 }
1693
src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs
-37
@@ -542,42 +542,5 @@ namespace WixToolsetTest.Converters
542 Assert.Equal(2, errors);
543 WixAssert.CompareLineByLine(expected, actual);
544 }
545 -
546 - [Fact]
547 - public void WarnsOnWixUIDoActionControlEvents()
548 - {
549 - var parse = String.Join(Environment.NewLine,
550 - "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
551 - " <Fragment>",
552 - " <UI Id='WixUI_Test'>",
553 - " <Publish Dialog='BrowseDlg' Control='OK' Event='DoAction' Value='WixUIValidatePath' Order='3' />",
554 - " </UI>",
555 - " </Fragment>",
556 - "</Wix>");
557 -
558 - var expected = new[]
559 - {
560 - "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
561 - " <Fragment>",
562 - " <UI Id=\"WixUI_Test\">",
563 - " <Publish Dialog=\"BrowseDlg\" Control=\"OK\" Event=\"DoAction\" Value=\"WixUIValidatePath\" Order=\"3\" />",
564 - " </UI>",
565 - " </Fragment>",
566 - "</Wix>",
567 - };
568 -
569 - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
570 -
571 - var messaging = new MockMessaging();
572 - var converter = new WixConverter(messaging, 2, null, null);
573 -
574 - var errors = converter.ConvertDocument(document);
575 -
576 - var actual = UnformattedDocumentLines(document);
577 -
578 - Assert.Equal(2, errors);
579 - Assert.Single(messaging.Messages.Where(m => m.Id == 65));
580 - WixAssert.CompareLineByLine(expected, actual);
581 - }
545 }
546 }
src/wix/test/WixToolsetTest.Converters/UIExtensionFixture.cs
+82
@@ -3,6 +3,7 @@
3 namespace WixToolsetTest.Converters
4 {
5 using System;
6 + using System.Linq;
7 using System.Xml.Linq;
8 using WixInternal.TestSupport;
9 using WixToolset.Converters;
@@ -55,5 +56,86 @@ namespace WixToolsetTest.Converters
56 var actualLines = UnformattedDocumentLines(document);
57 WixAssert.CompareLineByLine(expected, actualLines);
58 }
59 +
60 + [Fact]
61 + public void FixPrintCustomAction()
62 + {
63 + var parse = String.Join(Environment.NewLine,
64 + "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
65 + " <Fragment>",
66 + " <UI>",
67 + " <Dialog Id='CustomResumeDlg' Width='370' Height='270' Title='!(loc.ResumeDlg_Title)'>",
68 + " <Control Id='Print' Type='PushButton' X='112' Y='243' Width='56' Height='17' Text='!(loc.WixUIPrint)'>",
69 + " <Publish Event='DoAction' Value='WixUIPrintEula'>1</Publish>",
70 + " </Control>",
71 + " </Dialog>",
72 + " </UI>",
73 + " </Fragment>",
74 + "</Wix>");
75 +
76 + var expected = new[]
77 + {
78 + "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
79 + " <Fragment>",
80 + " <UI>",
81 + " <Dialog Id=\"CustomResumeDlg\" Width=\"370\" Height=\"270\" Title=\"!(loc.ResumeDlg_Title)\">",
82 + " <Control Id=\"Print\" Type=\"PushButton\" X=\"112\" Y=\"243\" Width=\"56\" Height=\"17\" Text=\"!(loc.WixUIPrint)\">",
83 + " <Publish Event=\"DoAction\" Value=\"WixUIPrintEula_$(sys.BUILDARCHSHORT)\" />",
84 + " </Control>",
85 + " </Dialog>",
86 + " </UI>",
87 + " </Fragment>",
88 + "</Wix>"
89 + };
90 +
91 + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
92 +
93 + var messaging = new MockMessaging();
94 + var converter = new WixConverter(messaging, 2, null, null);
95 +
96 + var errors = converter.ConvertDocument(document);
97 +
98 + var actual = UnformattedDocumentLines(document);
99 +
100 + WixAssert.CompareLineByLine(expected, actual);
101 + Assert.Equal(4, errors);
102 + }
103 +
104 + [Fact]
105 + public void FixValidatePathCustomAction()
106 + {
107 + var parse = String.Join(Environment.NewLine,
108 + "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
109 + " <Fragment>",
110 + " <UI Id='WixUI_Test'>",
111 + " <Publish Dialog='BrowseDlg' Control='OK' Event='DoAction' Value='WixUIValidatePath' Order='3' />",
112 + " </UI>",
113 + " </Fragment>",
114 + "</Wix>");
115 +
116 + var expected = new[]
117 + {
118 + "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
119 + " <Fragment>",
120 + " <UI Id=\"WixUI_Test\">",
121 + " <Publish Dialog=\"BrowseDlg\" Control=\"OK\" Event=\"DoAction\" Value=\"WixUIValidatePath_$(sys.BUILDARCHSHORT)\" Order=\"3\" />",
122 + " </UI>",
123 + " </Fragment>",
124 + "</Wix>",
125 + };
126 +
127 + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
128 +
129 + var messaging = new MockMessaging();
130 + var converter = new WixConverter(messaging, 2, null, null);
131 +
132 + var errors = converter.ConvertDocument(document);
133 +
134 + var actual = UnformattedDocumentLines(document);
135 +
136 + WixAssert.CompareLineByLine(expected, actual);
137 + Assert.Single(messaging.Messages.Where(m => m.Id == 65));
138 + Assert.Equal(2, errors);
139 + }
140 }
141 }