aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WixToolset.Converters/WixConverter.cs6
-rw-r--r--src/test/WixToolsetTest.Converters/ConditionFixture.cs38
2 files changed, 41 insertions, 3 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs
index b82c4490..1fcaacb4 100644
--- a/src/WixToolset.Converters/WixConverter.cs
+++ b/src/WixToolset.Converters/WixConverter.cs
@@ -680,10 +680,10 @@ namespace WixToolset.Converters
680 } 680 }
681 } 681 }
682 682
683 var xCondition = element.Element(ConditionElementName); 683 var xConditions = element.Elements(ConditionElementName).ToList();
684 if (xCondition != null) 684 foreach (var xCondition in xConditions)
685 { 685 {
686 var message = element.Attribute("Message")?.Value; 686 var message = xCondition.Attribute("Message")?.Value;
687 687
688 if (!String.IsNullOrEmpty(message) && 688 if (!String.IsNullOrEmpty(message) &&
689 TryGetInnerText(xCondition, out var text) && 689 TryGetInnerText(xCondition, out var text) &&
diff --git a/src/test/WixToolsetTest.Converters/ConditionFixture.cs b/src/test/WixToolsetTest.Converters/ConditionFixture.cs
index 65fa6734..629fbd2a 100644
--- a/src/test/WixToolsetTest.Converters/ConditionFixture.cs
+++ b/src/test/WixToolsetTest.Converters/ConditionFixture.cs
@@ -214,6 +214,44 @@ namespace WixToolsetTest.Converters
214 } 214 }
215 215
216 [Fact] 216 [Fact]
217 public void FixLaunchConditionInProduct()
218 {
219 var parse = String.Join(Environment.NewLine,
220 "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
221 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
222 " <Product>",
223 " <Condition Message='Stop the install'>",
224 " 1&lt;2",
225 " </Condition>",
226 " <Condition Message='Do not stop'>",
227 " 1=2",
228 " </Condition>",
229 " </Product>",
230 "</Wix>");
231
232 var expected = new[]
233 {
234 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
235 " <Product>",
236 " <Launch Condition=\"1&lt;2\" Message=\"Stop the install\" />",
237 " <Launch Condition=\"1=2\" Message=\"Do not stop\" />",
238 " </Product>",
239 "</Wix>"
240 };
241
242 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
243
244 var messaging = new MockMessaging();
245 var converter = new WixConverter(messaging, 2, null, null);
246
247 var errors = converter.ConvertDocument(document);
248 Assert.Equal(4, errors);
249
250 var actualLines = UnformattedDocumentLines(document);
251 WixAssert.CompareLineByLine(expected, actualLines);
252 }
253
254 [Fact]
217 public void FixPermissionExCondition() 255 public void FixPermissionExCondition()
218 { 256 {
219 var parse = String.Join(Environment.NewLine, 257 var parse = String.Join(Environment.NewLine,