aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Converters/WixConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Converters/WixConverter.cs')
-rw-r--r--src/WixToolset.Converters/WixConverter.cs95
1 files changed, 56 insertions, 39 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs
index 09a4168a..b8f2a516 100644
--- a/src/WixToolset.Converters/WixConverter.cs
+++ b/src/WixToolset.Converters/WixConverter.cs
@@ -119,7 +119,9 @@ namespace WixToolset.Converters
119 private static readonly XName SetPropertyElementName = WixNamespace + "SetProperty"; 119 private static readonly XName SetPropertyElementName = WixNamespace + "SetProperty";
120 private static readonly XName ShortcutPropertyElementName = WixNamespace + "ShortcutProperty"; 120 private static readonly XName ShortcutPropertyElementName = WixNamespace + "ShortcutProperty";
121 private static readonly XName SoftwareTagElementName = WixNamespace + "SoftwareTag"; 121 private static readonly XName SoftwareTagElementName = WixNamespace + "SoftwareTag";
122 private static readonly XName SoftwareTagRefElementName = WixNamespace + "SoftwareTagRef";
122 private static readonly XName TagElementName = XNamespace.None + "Tag"; 123 private static readonly XName TagElementName = XNamespace.None + "Tag";
124 private static readonly XName TagRefElementName = XNamespace.None + "TagRef";
123 private static readonly XName TextElementName = WixNamespace + "Text"; 125 private static readonly XName TextElementName = WixNamespace + "Text";
124 private static readonly XName UITextElementName = WixNamespace + "UIText"; 126 private static readonly XName UITextElementName = WixNamespace + "UIText";
125 private static readonly XName VariableElementName = WixNamespace + "Variable"; 127 private static readonly XName VariableElementName = WixNamespace + "Variable";
@@ -235,6 +237,7 @@ namespace WixToolset.Converters
235 { WixConverter.SetPropertyElementName, this.ConvertSetPropertyElement }, 237 { WixConverter.SetPropertyElementName, this.ConvertSetPropertyElement },
236 { WixConverter.ShortcutPropertyElementName, this.ConvertShortcutPropertyElement }, 238 { WixConverter.ShortcutPropertyElementName, this.ConvertShortcutPropertyElement },
237 { WixConverter.TagElementName, this.ConvertTagElement }, 239 { WixConverter.TagElementName, this.ConvertTagElement },
240 { WixConverter.TagRefElementName, this.ConvertTagRefElement },
238 { WixConverter.TextElementName, this.ConvertTextElement }, 241 { WixConverter.TextElementName, this.ConvertTextElement },
239 { WixConverter.UITextElementName, this.ConvertUITextElement }, 242 { WixConverter.UITextElementName, this.ConvertUITextElement },
240 { WixConverter.VariableElementName, this.ConvertVariableElement }, 243 { WixConverter.VariableElementName, this.ConvertVariableElement },
@@ -686,13 +689,7 @@ namespace WixToolset.Converters
686 689
687 private void ConvertApprovedExeForElevationElement(XElement element) 690 private void ConvertApprovedExeForElevationElement(XElement element)
688 { 691 {
689 var win64 = element.Attribute("Win64"); 692 this.RenameWin64ToBitness(element);
690 if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead."))
691 {
692 var value = this.UpdateWin64ValueToBitnessValue(win64);
693 element.Add(new XAttribute("Bitness", value));
694 win64.Remove();
695 }
696 } 693 }
697 694
698 private void ConvertBalBootstrapperApplicationRef(XElement element, string theme, XName balBAElementName, XName oldBalBAElementName = null) 695 private void ConvertBalBootstrapperApplicationRef(XElement element, string theme, XName balBAElementName, XName oldBalBAElementName = null)
@@ -897,13 +894,7 @@ namespace WixToolset.Converters
897 } 894 }
898 } 895 }
899 896
900 var win64 = element.Attribute("Win64"); 897 this.RenameWin64ToBitness(element);
901 if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead."))
902 {
903 var value = this.UpdateWin64ValueToBitnessValue(win64);
904 element.Add(new XAttribute("Bitness", value));
905 win64.Remove();
906 }
907 } 898 }
908 899
909 private void ConvertDirectoryElement(XElement element) 900 private void ConvertDirectoryElement(XElement element)
@@ -1289,28 +1280,13 @@ namespace WixToolset.Converters
1289 1280
1290 this.OnError(ConverterTestType.BurnHashAlgorithmChanged, element, "The hash algorithm for bundles changed from SHA1 to SHA512."); 1281 this.OnError(ConverterTestType.BurnHashAlgorithmChanged, element, "The hash algorithm for bundles changed from SHA1 to SHA512.");
1291 1282
1292 RemoveIfPresent(element.Attribute("CertificatePublicKey")); 1283 this.RemoveAttributeIfPresent(element, "CertificatePublicKey", ConverterTestType.BundleSignatureValidationObsolete, "The {0} element contains obsolete '{1}' attribute. Signature validation is no longer supported. The attribute will be removed.");
1293 RemoveIfPresent(element.Attribute("CertificateThumbprint")); 1284 this.RemoveAttributeIfPresent(element, "CertificateThumbprint", ConverterTestType.BundleSignatureValidationObsolete, "The {0} element contains obsolete '{1}' attribute. Signature validation is no longer supported. The attribute will be removed.");
1294
1295 void RemoveIfPresent(XAttribute xAttribute)
1296 {
1297 if (null != xAttribute
1298 && this.OnError(ConverterTestType.BundleSignatureValidationObsolete, element, "The chain package element contains obsolete '{0}' attribute. Signature validation is no longer supported. The attribute will be removed.", xAttribute.Name))
1299 {
1300 xAttribute.Remove();
1301 }
1302 }
1303 } 1285 }
1304 1286
1305 private void ConvertRegistrySearchElement(XElement element) 1287 private void ConvertRegistrySearchElement(XElement element)
1306 { 1288 {
1307 var win64 = element.Attribute("Win64"); 1289 this.RenameWin64ToBitness(element);
1308 if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead."))
1309 {
1310 var value = this.UpdateWin64ValueToBitnessValue(win64);
1311 element.Add(new XAttribute("Bitness", value));
1312 win64.Remove();
1313 }
1314 } 1290 }
1315 1291
1316 private void ConvertRequiredPrivilegeElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Name"); 1292 private void ConvertRequiredPrivilegeElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Name");
@@ -1394,6 +1370,18 @@ namespace WixToolset.Converters
1394 { 1370 {
1395 element.Name = SoftwareTagElementName; 1371 element.Name = SoftwareTagElementName;
1396 } 1372 }
1373
1374 this.RemoveAttributeIfPresent(element, "Licensed", ConverterTestType.SoftwareTagLicensedObsolete, "The {0} element contains obsolete '{1}' attribute. The attribute will be removed.");
1375 this.RemoveAttributeIfPresent(element, "Type", ConverterTestType.SoftwareTagLicensedObsolete, "The {0} element contains obsolete '{1}' attribute. The attribute will be removed.");
1376 this.RenameWin64ToBitness(element);
1377 }
1378
1379 private void ConvertTagRefElement(XElement element)
1380 {
1381 if (this.OnError(ConverterTestType.TagRefElementRenamed, element, "The TagRef element has been renamed. Use the 'SoftwareTagRef' element instead."))
1382 {
1383 element.Name = SoftwareTagRefElementName;
1384 }
1397 } 1385 }
1398 1386
1399 private void ConvertTextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); 1387 private void ConvertTextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
@@ -1543,13 +1531,7 @@ namespace WixToolset.Converters
1543 1531
1544 private void ConvertUtilRegistrySearchElement(XElement element) 1532 private void ConvertUtilRegistrySearchElement(XElement element)
1545 { 1533 {
1546 var win64 = element.Attribute("Win64"); 1534 this.RenameWin64ToBitness(element);
1547 if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The Win64 attribute has been renamed. Use the Bitness attribute instead."))
1548 {
1549 var value = this.UpdateWin64ValueToBitnessValue(win64);
1550 element.Add(new XAttribute("Bitness", value));
1551 win64.Remove();
1552 }
1553 1535
1554 if (this.SourceVersion < 4) 1536 if (this.SourceVersion < 4)
1555 { 1537 {
@@ -1593,6 +1575,26 @@ namespace WixToolset.Converters
1593 } 1575 }
1594 } 1576 }
1595 1577
1578 void RemoveAttributeIfPresent(XElement element, string attributeName, ConverterTestType type, string format)
1579 {
1580 var xAttribute = element.Attribute(attributeName);
1581 if (null != xAttribute && this.OnError(type, element, format, element.Name.LocalName, xAttribute.Name))
1582 {
1583 xAttribute.Remove();
1584 }
1585 }
1586
1587 private void RenameWin64ToBitness(XElement element)
1588 {
1589 var win64 = element.Attribute("Win64");
1590 if (win64 != null && this.OnError(ConverterTestType.Win64AttributeRenamed, element, "The {0} element's Win64 attribute has been renamed. Use the Bitness attribute instead.", element.Name.LocalName))
1591 {
1592 var value = this.UpdateWin64ValueToBitnessValue(win64);
1593 element.Add(new XAttribute("Bitness", value));
1594 win64.Remove();
1595 }
1596 }
1597
1596 private string UpdateWin64ValueToBitnessValue(XAttribute xWin64Attribute) 1598 private string UpdateWin64ValueToBitnessValue(XAttribute xWin64Attribute)
1597 { 1599 {
1598 var value = xWin64Attribute.Value ?? String.Empty; 1600 var value = xWin64Attribute.Value ?? String.Empty;
@@ -2185,6 +2187,21 @@ namespace WixToolset.Converters
2185 /// The RegistryKey element's Action attribute is obsolete. 2187 /// The RegistryKey element's Action attribute is obsolete.
2186 /// </summary> 2188 /// </summary>
2187 RegistryKeyActionObsolete, 2189 RegistryKeyActionObsolete,
2190
2191 /// <summary>
2192 /// The TagRef element has been renamed. Use the element 'SoftwareTagRef' name.
2193 /// </summary>
2194 TagRefElementRenamed,
2195
2196 /// <summary>
2197 /// The SoftwareTag element's Licensed attribute is obsolete.
2198 /// </summary>
2199 SoftwareTagLicensedObsolete,
2200
2201 /// <summary>
2202 /// The SoftwareTag element's Type attribute is obsolete.
2203 /// </summary>
2204 SoftwareTagTypeObsolete,
2188 } 2205 }
2189 } 2206 }
2190} 2207}