aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2020-11-09 15:50:10 -0500
committerBob Arnson <bob@firegiant.com>2020-11-09 16:02:54 -0500
commitd4a7583d9df4a3ac14f8c000802fb500b9948a29 (patch)
tree31ace7c92113fc327dce3cdb871dafccc3ce01a4
parent6a96c2ee082c37fd12d071514cab450f0c18618a (diff)
downloadwix-d4a7583d9df4a3ac14f8c000802fb500b9948a29.tar.gz
wix-d4a7583d9df4a3ac14f8c000802fb500b9948a29.tar.bz2
wix-d4a7583d9df4a3ac14f8c000802fb500b9948a29.zip
Warn about inability to convert Verb/@Target.
-rw-r--r--src/WixToolset.Converters/WixConverter.cs16
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterFixture.cs26
2 files changed, 42 insertions, 0 deletions
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
76 private static readonly XName TextElementName = WixNamespace + "Text"; 76 private static readonly XName TextElementName = WixNamespace + "Text";
77 private static readonly XName UITextElementName = WixNamespace + "UIText"; 77 private static readonly XName UITextElementName = WixNamespace + "UIText";
78 private static readonly XName VariableElementName = WixNamespace + "Variable"; 78 private static readonly XName VariableElementName = WixNamespace + "Variable";
79 private static readonly XName VerbElementName = WixNamespace + "Verb";
79 private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication"; 80 private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication";
80 private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx"; 81 private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx";
81 private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch"; 82 private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch";
@@ -177,6 +178,7 @@ namespace WixToolset.Converters
177 { WixConverter.PropertyElementName, this.ConvertPropertyElement }, 178 { WixConverter.PropertyElementName, this.ConvertPropertyElement },
178 { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, 179 { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace },
179 { WixConverter.IncludeElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, 180 { WixConverter.IncludeElementWithoutNamespaceName, this.ConvertElementWithoutNamespace },
181 { WixConverter.VerbElementName, this.ConvertVerbElement },
180 }; 182 };
181 183
182 this.Messaging = messaging; 184 this.Messaging = messaging;
@@ -768,6 +770,7 @@ namespace WixToolset.Converters
768 RemoveAttribute(xSummaryInformation, "Id"); 770 RemoveAttribute(xSummaryInformation, "Id");
769 MoveAttribute(xSummaryInformation, "InstallerVersion", xPackage, defaultValue: "500"); 771 MoveAttribute(xSummaryInformation, "InstallerVersion", xPackage, defaultValue: "500");
770 MoveAttribute(xSummaryInformation, "InstallScope", xPackage, "Scope", defaultValue: "perMachine"); 772 MoveAttribute(xSummaryInformation, "InstallScope", xPackage, "Scope", defaultValue: "perMachine");
773 RemoveAttribute(xSummaryInformation, "Languages");
771 RemoveAttribute(xSummaryInformation, "Platform"); 774 RemoveAttribute(xSummaryInformation, "Platform");
772 RemoveAttribute(xSummaryInformation, "Platforms"); 775 RemoveAttribute(xSummaryInformation, "Platforms");
773 RemoveAttribute(xSummaryInformation, "ReadOnly"); 776 RemoveAttribute(xSummaryInformation, "ReadOnly");
@@ -887,6 +890,14 @@ namespace WixToolset.Converters
887 } 890 }
888 } 891 }
889 892
893 private void ConvertVerbElement(XElement element)
894 {
895 if (null != element.Attribute("Target"))
896 {
897 this.OnError(ConverterTestType.VerbTargetNotConvertable, element, "The Verb/@Target attribute has been replaced with typed @TargetFile and @TargetProperty attributes.");
898 }
899 }
900
890 private void ConvertCustomActionElement(XElement xCustomAction) 901 private void ConvertCustomActionElement(XElement xCustomAction)
891 { 902 {
892 var xBinaryKey = xCustomAction.Attribute("BinaryKey"); 903 var xBinaryKey = xCustomAction.Attribute("BinaryKey");
@@ -1473,6 +1484,11 @@ namespace WixToolset.Converters
1473 /// InstallerVersion has breaking change when missing. 1484 /// InstallerVersion has breaking change when missing.
1474 /// </summary> 1485 /// </summary>
1475 InstallerVersionBehaviorChange, 1486 InstallerVersionBehaviorChange,
1487
1488 /// <summary>
1489 /// Verb/@Target can't be converted.
1490 /// </summary>
1491 VerbTargetNotConvertable,
1476 } 1492 }
1477 } 1493 }
1478} 1494}
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
355 Assert.Equal(1, errors); 355 Assert.Equal(1, errors);
356 Assert.Equal(expected, actual); 356 Assert.Equal(expected, actual);
357 } 357 }
358
359 [Fact]
360 public void CantConvertVerbTarget()
361 {
362 var parse = String.Join(Environment.NewLine,
363 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
364 " <Verb Target='anything' />",
365 "</Wix>");
366
367 var expected = String.Join(Environment.NewLine,
368 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
369 " <Verb Target=\"anything\" />",
370 "</Wix>");
371
372 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
373
374 var messaging = new MockMessaging();
375 var converter = new WixConverter(messaging, 2, null, null);
376
377 var errors = converter.ConvertDocument(document);
378
379 var actual = UnformattedDocumentString(document);
380
381 Assert.Equal(2, errors);
382 Assert.Equal(expected, actual);
383 }
358 } 384 }
359} 385}