diff options
| author | Bob Arnson <bob@firegiant.com> | 2018-10-08 20:16:59 -0400 |
|---|---|---|
| committer | Rob Mensching <rob@robmensching.com> | 2018-10-08 17:23:28 -0700 |
| commit | 008a6fd58bfb40ed58a184aff40c3f01bb26391b (patch) | |
| tree | 568ff309ecad8eea1615a37f2aaa5e3bf14e506b /src/wixcop | |
| parent | 34e49f5515995ec30d899879900473bbf07aeda1 (diff) | |
| download | wix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.tar.gz wix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.tar.bz2 wix-008a6fd58bfb40ed58a184aff40c3f01bb26391b.zip | |
Handle the rename of WixCA and QtExec* binary, custom action, and property ids.
Fixed wixtoolset/issues#5887.
Diffstat (limited to 'src/wixcop')
| -rw-r--r-- | src/wixcop/Converter.cs | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/src/wixcop/Converter.cs b/src/wixcop/Converter.cs index e125b39c..5408d370 100644 --- a/src/wixcop/Converter.cs +++ b/src/wixcop/Converter.cs | |||
| @@ -28,6 +28,8 @@ namespace WixToolset.Tools.WixCop | |||
| 28 | private static readonly XName MspPackageElementName = WixNamespace + "MspPackage"; | 28 | private static readonly XName MspPackageElementName = WixNamespace + "MspPackage"; |
| 29 | private static readonly XName MsuPackageElementName = WixNamespace + "MsuPackage"; | 29 | private static readonly XName MsuPackageElementName = WixNamespace + "MsuPackage"; |
| 30 | private static readonly XName PayloadElementName = WixNamespace + "Payload"; | 30 | private static readonly XName PayloadElementName = WixNamespace + "Payload"; |
| 31 | private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; | ||
| 32 | private static readonly XName PropertyElementName = WixNamespace + "Property"; | ||
| 31 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; | 33 | private static readonly XName WixElementWithoutNamespaceName = XNamespace.None + "Wix"; |
| 32 | 34 | ||
| 33 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() | 35 | private static readonly Dictionary<string, XNamespace> OldToNewNamespaceMapping = new Dictionary<string, XNamespace>() |
| @@ -88,6 +90,8 @@ namespace WixToolset.Tools.WixCop | |||
| 88 | { Converter.MspPackageElementName, this.ConvertSuppressSignatureValidation }, | 90 | { Converter.MspPackageElementName, this.ConvertSuppressSignatureValidation }, |
| 89 | { Converter.MsuPackageElementName, this.ConvertSuppressSignatureValidation }, | 91 | { Converter.MsuPackageElementName, this.ConvertSuppressSignatureValidation }, |
| 90 | { Converter.PayloadElementName, this.ConvertSuppressSignatureValidation }, | 92 | { Converter.PayloadElementName, this.ConvertSuppressSignatureValidation }, |
| 93 | { Converter.CustomActionElementName, this.ConvertCustomActionElement }, | ||
| 94 | { Converter.PropertyElementName, this.ConvertPropertyElement }, | ||
| 91 | { Converter.WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace } | 95 | { Converter.WixElementWithoutNamespaceName, this.ConvertWixElementWithoutNamespace } |
| 92 | }; | 96 | }; |
| 93 | 97 | ||
| @@ -263,7 +267,7 @@ namespace WixToolset.Tools.WixCop | |||
| 263 | } | 267 | } |
| 264 | } | 268 | } |
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | private void ConvertElement(XElement element) | 271 | private void ConvertElement(XElement element) |
| 268 | { | 272 | { |
| 269 | // Gather any deprecated namespaces, then update this element tree based on those deprecations. | 273 | // Gather any deprecated namespaces, then update this element tree based on those deprecations. |
| @@ -324,7 +328,7 @@ namespace WixToolset.Tools.WixCop | |||
| 324 | 328 | ||
| 325 | if (null != suppressSignatureValidation) | 329 | if (null != suppressSignatureValidation) |
| 326 | { | 330 | { |
| 327 | if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' instead.", suppressSignatureValidation)) | 331 | if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' attribute instead.", suppressSignatureValidation)) |
| 328 | { | 332 | { |
| 329 | if ("no" == suppressSignatureValidation.Value) | 333 | if ("no" == suppressSignatureValidation.Value) |
| 330 | { | 334 | { |
| @@ -336,6 +340,49 @@ namespace WixToolset.Tools.WixCop | |||
| 336 | } | 340 | } |
| 337 | } | 341 | } |
| 338 | 342 | ||
| 343 | private void ConvertCustomActionElement(XElement xCustomAction) | ||
| 344 | { | ||
| 345 | var xBinaryKey = xCustomAction.Attribute("BinaryKey"); | ||
| 346 | |||
| 347 | if (xBinaryKey?.Value == "WixCA") | ||
| 348 | { | ||
| 349 | if (this.OnError(ConverterTestType.WixCABinaryIdRenamed, xCustomAction, "The WixCA custom action DLL Binary table id has been renamed. Use the id 'UtilCA' instead.")) | ||
| 350 | { | ||
| 351 | xBinaryKey.Value = "UtilCA"; | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 355 | var xDllEntry = xCustomAction.Attribute("DllEntry"); | ||
| 356 | |||
| 357 | if (xDllEntry?.Value == "CAQuietExec" || xDllEntry?.Value == "CAQuietExec64") | ||
| 358 | { | ||
| 359 | if (this.OnError(ConverterTestType.QuietExecCustomActionsRenamed, xCustomAction, "The CAQuietExec and CAQuietExec64 custom action ids have been renamed. Use the ids 'WixQuietExec' and 'WixQuietExec64' instead.")) | ||
| 360 | { | ||
| 361 | xDllEntry.Value = xDllEntry.Value.Replace("CAQuietExec", "WixQuietExec"); | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | var xProperty = xCustomAction.Attribute("Property"); | ||
| 366 | |||
| 367 | if (xProperty?.Value == "QtExecCmdLine" || xProperty?.Value == "QtExec64CmdLine") | ||
| 368 | { | ||
| 369 | if (this.OnError(ConverterTestType.QuietExecCustomActionsRenamed, xCustomAction, "The QtExecCmdLine and QtExec64CmdLine property ids have been renamed. Use the ids 'WixQuietExecCmdLine' and 'WixQuietExec64CmdLine' instead.")) | ||
| 370 | { | ||
| 371 | xProperty.Value = xProperty.Value.Replace("QtExec", "WixQuietExec"); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | } | ||
| 375 | |||
| 376 | private void ConvertPropertyElement(XElement xProperty) | ||
| 377 | { | ||
| 378 | var xId = xProperty.Attribute("Id"); | ||
| 379 | |||
| 380 | if (xId.Value == "QtExecCmdTimeout") | ||
| 381 | { | ||
| 382 | this.OnError(ConverterTestType.QtExecCmdTimeoutAmbiguous, xProperty, "QtExecCmdTimeout was previously used for both CAQuietExec and CAQuietExec64. For WixQuietExec, use WixQuietExecCmdTimeout. For WixQuietExec64, use WixQuietExec64CmdTimeout."); | ||
| 383 | } | ||
| 384 | } | ||
| 385 | |||
| 339 | /// <summary> | 386 | /// <summary> |
| 340 | /// Converts a Wix element. | 387 | /// Converts a Wix element. |
| 341 | /// </summary> | 388 | /// </summary> |
| @@ -549,6 +596,21 @@ namespace WixToolset.Tools.WixCop | |||
| 549 | /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation. | 596 | /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation. |
| 550 | /// </summary> | 597 | /// </summary> |
| 551 | SuppressSignatureValidationDeprecated, | 598 | SuppressSignatureValidationDeprecated, |
| 599 | |||
| 600 | /// <summary> | ||
| 601 | /// WixCA Binary/@Id has been renamed to UtilCA. | ||
| 602 | /// </summary> | ||
| 603 | WixCABinaryIdRenamed, | ||
| 604 | |||
| 605 | /// <summary> | ||
| 606 | /// QtExec custom actions have been renamed. | ||
| 607 | /// </summary> | ||
| 608 | QuietExecCustomActionsRenamed, | ||
| 609 | |||
| 610 | /// <summary> | ||
| 611 | /// QtExecCmdTimeout was previously used for both CAQuietExec and CAQuietExec64. For WixQuietExec, use WixQuietExecCmdTimeout. For WixQuietExec64, use WixQuietExec64CmdTimeout. | ||
| 612 | /// </summary> | ||
| 613 | QtExecCmdTimeoutAmbiguous, | ||
| 552 | } | 614 | } |
| 553 | } | 615 | } |
| 554 | } | 616 | } |
