diff options
Diffstat (limited to 'src/WixToolset.Converters/WixConverter.cs')
-rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index 18cd7115..4d5564b4 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
@@ -636,8 +636,8 @@ namespace WixToolset.Converters | |||
636 | var win64 = element.Attribute("Win64"); | 636 | var win64 = element.Attribute("Win64"); |
637 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) | 637 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) |
638 | { | 638 | { |
639 | var value = win64.Value; | 639 | var value = this.UpdateWin64ValueToBitnessValue(win64); |
640 | element.Add(new XAttribute("Bitness", value == "yes" ? "always64" : "always32")); | 640 | element.Add(new XAttribute("Bitness", value)); |
641 | win64.Remove(); | 641 | win64.Remove(); |
642 | } | 642 | } |
643 | } | 643 | } |
@@ -755,8 +755,8 @@ namespace WixToolset.Converters | |||
755 | var win64 = element.Attribute("Win64"); | 755 | var win64 = element.Attribute("Win64"); |
756 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) | 756 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) |
757 | { | 757 | { |
758 | var value = win64.Value; | 758 | var value = this.UpdateWin64ValueToBitnessValue(win64); |
759 | element.Add(new XAttribute("Bitness", value == "yes" ? "always64" : "always32")); | 759 | element.Add(new XAttribute("Bitness", value)); |
760 | win64.Remove(); | 760 | win64.Remove(); |
761 | } | 761 | } |
762 | } | 762 | } |
@@ -1104,8 +1104,8 @@ namespace WixToolset.Converters | |||
1104 | var win64 = element.Attribute("Win64"); | 1104 | var win64 = element.Attribute("Win64"); |
1105 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) | 1105 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) |
1106 | { | 1106 | { |
1107 | var value = win64.Value; | 1107 | var value = this.UpdateWin64ValueToBitnessValue(win64); |
1108 | element.Add(new XAttribute("Bitness", value == "yes" ? "always64" : "always32")); | 1108 | element.Add(new XAttribute("Bitness", value)); |
1109 | win64.Remove(); | 1109 | win64.Remove(); |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
@@ -1296,8 +1296,8 @@ namespace WixToolset.Converters | |||
1296 | var win64 = element.Attribute("Win64"); | 1296 | var win64 = element.Attribute("Win64"); |
1297 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) | 1297 | if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead.")) |
1298 | { | 1298 | { |
1299 | var value = win64.Value; | 1299 | var value = this.UpdateWin64ValueToBitnessValue(win64); |
1300 | element.Add(new XAttribute("Bitness", value == "yes" ? "always64" : "always32")); | 1300 | element.Add(new XAttribute("Bitness", value)); |
1301 | win64.Remove(); | 1301 | win64.Remove(); |
1302 | } | 1302 | } |
1303 | 1303 | ||
@@ -1341,6 +1341,21 @@ namespace WixToolset.Converters | |||
1341 | } | 1341 | } |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | private string UpdateWin64ValueToBitnessValue(XAttribute xWin64Attribute) | ||
1345 | { | ||
1346 | var value = xWin64Attribute.Value ?? String.Empty; | ||
1347 | switch (value) | ||
1348 | { | ||
1349 | case "yes": | ||
1350 | return "always64"; | ||
1351 | case "no": | ||
1352 | return "always32"; | ||
1353 | default: | ||
1354 | this.OnError(ConverterTestType.Win64AttributeRenameCannotBeAutomatic, xWin64Attribute, "Breaking change: The Win64 attribute's value '{0}' cannot be converted automatically to the new Bitness attribute.", value); | ||
1355 | return value; | ||
1356 | } | ||
1357 | } | ||
1358 | |||
1344 | private IEnumerable<ConverterTestType> YieldConverterTypes(IEnumerable<string> types) | 1359 | private IEnumerable<ConverterTestType> YieldConverterTypes(IEnumerable<string> types) |
1345 | { | 1360 | { |
1346 | if (null != types) | 1361 | if (null != types) |
@@ -1795,6 +1810,11 @@ namespace WixToolset.Converters | |||
1795 | /// The Win64 attribute has been renamed. Use the Bitness attribute instead. | 1810 | /// The Win64 attribute has been renamed. Use the Bitness attribute instead. |
1796 | /// </summary> | 1811 | /// </summary> |
1797 | Win64AttributeRenamed, | 1812 | Win64AttributeRenamed, |
1813 | |||
1814 | /// <summary> | ||
1815 | /// Breaking change: The Win64 attribute's value '{0}' cannot be converted automatically to the new Bitness attribute. | ||
1816 | /// </summary> | ||
1817 | Win64AttributeRenameCannotBeAutomatic, | ||
1798 | } | 1818 | } |
1799 | } | 1819 | } |
1800 | } | 1820 | } |