From d4a7583d9df4a3ac14f8c000802fb500b9948a29 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 9 Nov 2020 15:50:10 -0500 Subject: Warn about inability to convert Verb/@Target. --- src/WixToolset.Converters/WixConverter.cs | 16 +++++++++++++ .../WixToolsetTest.Converters/ConverterFixture.cs | 26 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'src') diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index be09a683..2100b22d 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs @@ -76,6 +76,7 @@ namespace WixToolset.Converters private static readonly XName TextElementName = WixNamespace + "Text"; private static readonly XName UITextElementName = WixNamespace + "UIText"; private static readonly XName VariableElementName = WixNamespace + "Variable"; + private static readonly XName VerbElementName = WixNamespace + "Verb"; private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication"; private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx"; private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch"; @@ -177,6 +178,7 @@ namespace WixToolset.Converters { WixConverter.PropertyElementName, this.ConvertPropertyElement }, { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, { WixConverter.IncludeElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, + { WixConverter.VerbElementName, this.ConvertVerbElement }, }; this.Messaging = messaging; @@ -768,6 +770,7 @@ namespace WixToolset.Converters RemoveAttribute(xSummaryInformation, "Id"); MoveAttribute(xSummaryInformation, "InstallerVersion", xPackage, defaultValue: "500"); MoveAttribute(xSummaryInformation, "InstallScope", xPackage, "Scope", defaultValue: "perMachine"); + RemoveAttribute(xSummaryInformation, "Languages"); RemoveAttribute(xSummaryInformation, "Platform"); RemoveAttribute(xSummaryInformation, "Platforms"); RemoveAttribute(xSummaryInformation, "ReadOnly"); @@ -887,6 +890,14 @@ namespace WixToolset.Converters } } + private void ConvertVerbElement(XElement element) + { + if (null != element.Attribute("Target")) + { + this.OnError(ConverterTestType.VerbTargetNotConvertable, element, "The Verb/@Target attribute has been replaced with typed @TargetFile and @TargetProperty attributes."); + } + } + private void ConvertCustomActionElement(XElement xCustomAction) { var xBinaryKey = xCustomAction.Attribute("BinaryKey"); @@ -1473,6 +1484,11 @@ namespace WixToolset.Converters /// InstallerVersion has breaking change when missing. /// InstallerVersionBehaviorChange, + + /// + /// Verb/@Target can't be converted. + /// + VerbTargetNotConvertable, } } } diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index 29f34412..c74ef121 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs @@ -355,5 +355,31 @@ namespace WixToolsetTest.Converters Assert.Equal(1, errors); Assert.Equal(expected, actual); } + + [Fact] + public void CantConvertVerbTarget() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + ""); + + var expected = String.Join(Environment.NewLine, + "", + " ", + ""); + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + + var actual = UnformattedDocumentString(document); + + Assert.Equal(2, errors); + Assert.Equal(expected, actual); + } } } -- cgit v1.2.3-55-g6feb