diff options
Diffstat (limited to '')
| -rw-r--r-- | src/wix/WixToolset.Converters/WixConverter.cs | 29 | ||||
| -rw-r--r-- | src/wix/test/WixToolsetTest.Converters/ConditionFixture.cs | 18 |
2 files changed, 19 insertions, 28 deletions
diff --git a/src/wix/WixToolset.Converters/WixConverter.cs b/src/wix/WixToolset.Converters/WixConverter.cs index dc4a0bfa..86664a9f 100644 --- a/src/wix/WixToolset.Converters/WixConverter.cs +++ b/src/wix/WixToolset.Converters/WixConverter.cs | |||
| @@ -289,7 +289,7 @@ namespace WixToolset.Converters | |||
| 289 | { WixConverter.DirectoryRefElementName, this.ConvertDirectoryRefElement }, | 289 | { WixConverter.DirectoryRefElementName, this.ConvertDirectoryRefElement }, |
| 290 | { WixConverter.FeatureElementName, this.ConvertFeatureElement }, | 290 | { WixConverter.FeatureElementName, this.ConvertFeatureElement }, |
| 291 | { WixConverter.FileElementName, this.ConvertFileElement }, | 291 | { WixConverter.FileElementName, this.ConvertFileElement }, |
| 292 | { WixConverter.FragmentElementName, this.ConvertFragmentElement }, | 292 | { WixConverter.ConditionElementName, this.ConvertLaunchConditionElement }, |
| 293 | { WixConverter.FirewallRemoteAddressElementName, this.ConvertFirewallRemoteAddressElement }, | 293 | { WixConverter.FirewallRemoteAddressElementName, this.ConvertFirewallRemoteAddressElement }, |
| 294 | { WixConverter.EmbeddedChainerElementName, this.ConvertEmbeddedChainerElement }, | 294 | { WixConverter.EmbeddedChainerElementName, this.ConvertEmbeddedChainerElement }, |
| 295 | { WixConverter.ErrorElementName, this.ConvertErrorElement }, | 295 | { WixConverter.ErrorElementName, this.ConvertErrorElement }, |
| @@ -1064,7 +1064,7 @@ namespace WixToolset.Converters | |||
| 1064 | { | 1064 | { |
| 1065 | xCondition.Remove(); | 1065 | xCondition.Remove(); |
| 1066 | element.Add(new XAttribute("Condition", text)); | 1066 | element.Add(new XAttribute("Condition", text)); |
| 1067 | lab. RemoveOrphanTextNodes(); | 1067 | lab.RemoveOrphanTextNodes(); |
| 1068 | lab.AddCommentsAsSiblings(comments); | 1068 | lab.AddCommentsAsSiblings(comments); |
| 1069 | } | 1069 | } |
| 1070 | } | 1070 | } |
| @@ -1205,25 +1205,20 @@ namespace WixToolset.Converters | |||
| 1205 | } | 1205 | } |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | private void ConvertFragmentElement(XElement element) | 1208 | private void ConvertLaunchConditionElement(XElement element) |
| 1209 | { | 1209 | { |
| 1210 | var xConditions = element.Elements(ConditionElementName).ToList(); | 1210 | var message = element.Attribute("Message")?.Value; |
| 1211 | 1211 | ||
| 1212 | foreach (var xCondition in xConditions) | 1212 | if (!String.IsNullOrEmpty(message) && |
| 1213 | TryGetInnerText(element, out var text, out var comments) && | ||
| 1214 | this.OnInformation(ConverterTestType.InnerTextDeprecated, element, "Using {0} element text is deprecated. Use the 'Launch' element instead.", element.Name.LocalName)) | ||
| 1213 | { | 1215 | { |
| 1214 | var message = xCondition.Attribute("Message")?.Value; | 1216 | using (var lab = new ConversionLab(element)) |
| 1215 | |||
| 1216 | if (!String.IsNullOrEmpty(message) && | ||
| 1217 | TryGetInnerText(xCondition, out var text, out var comments) && | ||
| 1218 | this.OnInformation(ConverterTestType.InnerTextDeprecated, element, "Using {0} element text is deprecated. Use the 'Launch' element instead.", xCondition.Name.LocalName)) | ||
| 1219 | { | 1217 | { |
| 1220 | using (var lab = new ConversionLab(xCondition)) | 1218 | lab.ReplaceTargetElement(new XElement(LaunchElementName, |
| 1221 | { | 1219 | new XAttribute("Condition", text), |
| 1222 | lab.ReplaceTargetElement(new XElement(LaunchElementName, | 1220 | new XAttribute("Message", message))); |
| 1223 | new XAttribute("Condition", text), | 1221 | lab.AddCommentsAsSiblings(comments); |
| 1224 | new XAttribute("Message", message))); | ||
| 1225 | lab.AddCommentsAsSiblings(comments); | ||
| 1226 | } | ||
| 1227 | } | 1222 | } |
| 1228 | } | 1223 | } |
| 1229 | } | 1224 | } |
diff --git a/src/wix/test/WixToolsetTest.Converters/ConditionFixture.cs b/src/wix/test/WixToolsetTest.Converters/ConditionFixture.cs index 84e1b4c3..e3563c60 100644 --- a/src/wix/test/WixToolsetTest.Converters/ConditionFixture.cs +++ b/src/wix/test/WixToolsetTest.Converters/ConditionFixture.cs | |||
| @@ -382,19 +382,15 @@ namespace WixToolsetTest.Converters | |||
| 382 | var parse = String.Join(Environment.NewLine, | 382 | var parse = String.Join(Environment.NewLine, |
| 383 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | 383 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", |
| 384 | "<Include xmlns='http://schemas.microsoft.com/wix/2006/wi'>", | 384 | "<Include xmlns='http://schemas.microsoft.com/wix/2006/wi'>", |
| 385 | " <Fragment>", | 385 | " <Condition Message='from wxi'>", |
| 386 | " <Condition Message='from wxi'>", | 386 | " wxicondition", |
| 387 | " wxicondition", | 387 | " </Condition>", |
| 388 | " </Condition>", | ||
| 389 | " </Fragment>", | ||
| 390 | "</Include>"); | 388 | "</Include>"); |
| 391 | 389 | ||
| 392 | var expected = new[] | 390 | var expected = new[] |
| 393 | { | 391 | { |
| 394 | "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | 392 | "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
| 395 | " <Fragment>", | 393 | " <Launch Condition=\"wxicondition\" Message=\"from wxi\" />", |
| 396 | " <Launch Condition=\"wxicondition\" Message=\"from wxi\" />", | ||
| 397 | " </Fragment>", | ||
| 398 | "</Include>" | 394 | "</Include>" |
| 399 | }; | 395 | }; |
| 400 | 396 | ||
| @@ -485,7 +481,7 @@ namespace WixToolsetTest.Converters | |||
| 485 | } | 481 | } |
| 486 | 482 | ||
| 487 | [Fact] | 483 | [Fact] |
| 488 | public void FixLaunchCondition() | 484 | public void FixLaunchConditionInFragment() |
| 489 | { | 485 | { |
| 490 | var parse = String.Join(Environment.NewLine, | 486 | var parse = String.Join(Environment.NewLine, |
| 491 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | 487 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", |
| @@ -569,7 +565,7 @@ namespace WixToolsetTest.Converters | |||
| 569 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | 565 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", |
| 570 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", | 566 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", |
| 571 | " <Product>", | 567 | " <Product>", |
| 572 | " <Package />", | 568 | " <Package />", |
| 573 | " <Condition Message='Stop the install'>", | 569 | " <Condition Message='Stop the install'>", |
| 574 | " 1<2", | 570 | " 1<2", |
| 575 | " </Condition>", | 571 | " </Condition>", |
| @@ -583,7 +579,7 @@ namespace WixToolsetTest.Converters | |||
| 583 | { | 579 | { |
| 584 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | 580 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
| 585 | " <Package Compressed=\"no\">", | 581 | " <Package Compressed=\"no\">", |
| 586 | " ", | 582 | " ", |
| 587 | " <Launch Condition=\"1<2\" Message=\"Stop the install\" />", | 583 | " <Launch Condition=\"1<2\" Message=\"Stop the install\" />", |
| 588 | " <Launch Condition=\"1=2\" Message=\"Do not stop\" />", | 584 | " <Launch Condition=\"1=2\" Message=\"Do not stop\" />", |
| 589 | " </Package>", | 585 | " </Package>", |
