@joebigelow / wix / commits / 901e856e

Correctly report error when Publish/@Condition='1'

Rob Mensching committed Jul 18, 2020 at 14:57 UTC 901e856ef5c72be5fc7cfb3077e2e60892ddd4cc
2 files changed +8 -2
src/WixToolset.Converters/WixConverter.cs
+7 -1
@@ -693,7 +693,8 @@ namespace WixToolset.Converters
693 this.ConvertInnerTextToAttribute(element, "Condition");
694
695 var xCondition = element.Attribute("Condition");
696 - if (xCondition?.Value == "1")
696 + if (xCondition?.Value == "1" &&
697 + this.OnError(ConverterTestType.PublishConditionOneUnnecessary, element, "Adding Condition='1' on {0} elements is no longer necessary. Remove the Condition attribute.", xCondition.Name.LocalName))
698 {
699 xCondition.Remove();
700 }
@@ -1207,6 +1208,11 @@ namespace WixToolset.Converters
1208 /// The Feature AllowAdvertise attribute value deprecated.
1209 /// </summary>
1210 FeatureAllowAdvertiseValueDeprecated,
1211 +
1212 + /// <summary>
1213 + /// The Condition='1' attribute is unnecessary on Publish elements.
1214 + /// </summary>
1215 + PublishConditionOneUnnecessary
1216 }
1217 }
1218 }
src/test/WixToolsetTest.Converters/ConditionFixture.cs
+1 -1
@@ -96,7 +96,7 @@ namespace WixToolsetTest.Converters
96 var converter = new WixConverter(messaging, 2, null, null);
97
98 var errors = converter.ConvertDocument(document);
99 - Assert.Equal(4, errors);
99 + Assert.Equal(5, errors);
100
101 var actualLines = UnformattedDocumentLines(document);
102 CompareLineByLine(expected, actualLines);