@joebigelow / wix-1 / commits / c54f3083

Add message for DoAction WixUI custom actions.

Bob Arnson committed Dec 12, 2022 at 21:12 UTC c54f3083489827a1e57c6fd7f3d76f62ddc6e85e
2 files changed +47
src/wix/WixToolset.Converters/WixConverter.cs
+10
@@ -1676,6 +1676,16 @@ namespace WixToolset.Converters
1676 lab.AddCommentsAsSiblings(comments);
1677 }
1678 }
1679 +
1680 + var evnt = element.Attribute("Event")?.Value;
1681 + var value = element.Attribute("Value")?.Value;
1682 +
1683 + if (evnt?.Equals("DoAction", StringComparison.OrdinalIgnoreCase) == true
1684 + && value?.StartsWith("WixUI", StringComparison.OrdinalIgnoreCase) == true
1685 + && 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."))
1686 + {
1687 + // Just warn.
1688 + }
1689 }
1690
1691 private void ConvertMultiStringValueElement(XElement element)
src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs
+37
@@ -542,5 +542,42 @@ 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 + }
582 }
583 }