Add warnings for util:RegistrySearch (value) and DisplayInternalUI.
Sean Hall committed
Nov 1, 2020 at 17:45 UTC
06b0b7b3e5504d062fc2226dd9a64dc4efa41f47
3 files changed
+71
-35
src/WixToolset.Converters/WixConverter.cs
+36
-2
@@ -78,6 +78,7 @@ namespace WixToolset.Converters
78
private static readonly XName VariableElementName = WixNamespace + "Variable";
79
private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication";
80
private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx";
81
+ private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch";
82
private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig";
83
private static readonly XName CustomActionElementName = WixNamespace + "CustomAction";
84
private static readonly XName PropertyElementName = WixNamespace + "Property";
@@ -151,8 +152,8 @@ namespace WixToolset.Converters
152
{ WixConverter.ErrorElementName, this.ConvertErrorElement },
153
{ WixConverter.ExePackageElementName, this.ConvertSuppressSignatureValidation },
154
{ WixConverter.ModuleElementName, this.ConvertModuleElement },
154
- { WixConverter.MsiPackageElementName, this.ConvertSuppressSignatureValidation },
155
- { WixConverter.MspPackageElementName, this.ConvertSuppressSignatureValidation },
155
+ { WixConverter.MsiPackageElementName, this.ConvertWindowsInstallerPackageElement },
156
+ { WixConverter.MspPackageElementName, this.ConvertWindowsInstallerPackageElement },
157
{ WixConverter.MsuPackageElementName, this.ConvertSuppressSignatureValidation },
158
{ WixConverter.PayloadElementName, this.ConvertSuppressSignatureValidation },
159
{ WixConverter.PermissionExElementName, this.ConvertPermissionExElement },
@@ -171,6 +172,7 @@ namespace WixToolset.Converters
172
{ WixConverter.VariableElementName, this.ConvertVariableElement },
173
{ WixConverter.UtilCloseApplicationElementName, this.ConvertUtilCloseApplicationElementName },
174
{ WixConverter.UtilPermissionExElementName, this.ConvertUtilPermissionExElement },
175
+ { WixConverter.UtilRegistrySearchName, this.ConvertUtilRegistrySearchElement },
176
{ WixConverter.UtilXmlConfigElementName, this.ConvertUtilXmlConfigElement },
177
{ WixConverter.PropertyElementName, this.ConvertPropertyElement },
178
{ WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace },
@@ -863,6 +865,16 @@ namespace WixToolset.Converters
865
866
private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
867
868
+ private void ConvertWindowsInstallerPackageElement(XElement element)
869
+ {
870
+ this.ConvertSuppressSignatureValidation(element);
871
+
872
+ if (null != element.Attribute("DisplayInternalUI"))
873
+ {
874
+ this.OnError(ConverterTestType.DisplayInternalUiNotConvertable, element, "The DisplayInternalUI functionality has fundamentally changed and requires BootstrapperApplication support.");
875
+ }
876
+ }
877
+
878
private void ConvertCustomActionElement(XElement xCustomAction)
879
{
880
var xBinaryKey = xCustomAction.Attribute("BinaryKey");
@@ -986,6 +998,18 @@ namespace WixToolset.Converters
998
}
999
}
1000
1001
+ private void ConvertUtilRegistrySearchElement(XElement element)
1002
+ {
1003
+ if (this.SourceVersion < 4)
1004
+ {
1005
+ var result = element.Attribute("Result")?.Value;
1006
+ if (result == null || result == "value")
1007
+ {
1008
+ this.OnError(ConverterTestType.UtilRegistryValueSearchBehaviorChange, element, "Breaking change: util:RegistrySearch for a value no longer clears the variable when the key or value is missing.");
1009
+ }
1010
+ }
1011
+ }
1012
+
1013
private void ConvertUtilXmlConfigElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
1014
1015
/// <summary>
@@ -1422,6 +1446,16 @@ namespace WixToolset.Converters
1446
/// A MediaTemplate with no attributes set is now provided by default.
1447
/// </summary>
1448
DefaultMediaTemplate,
1449
+
1450
+ /// <summary>
1451
+ /// util:RegistrySearch has breaking change when value is missing.
1452
+ /// </summary>
1453
+ UtilRegistryValueSearchBehaviorChange,
1454
+
1455
+ /// <summary>
1456
+ /// DisplayInternalUI can't be converted.
1457
+ /// </summary>
1458
+ DisplayInternalUiNotConvertable,
1459
}
1460
}
1461
}
src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
renamed
-33
@@ -43,38 +43,5 @@ namespace WixToolsetTest.Converters
43
var actualLines = UnformattedDocumentLines(document);
44
WixAssert.CompareLineByLine(expected, actualLines);
45
}
46
-
47
- [Fact]
48
- public void FixXmlConfigValue()
49
- {
50
- var parse = String.Join(Environment.NewLine,
51
- "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
52
- " <Fragment>",
53
- " <util:XmlConfig Id='Change' ElementPath='book'>",
54
- " a<>b",
55
- " </util:XmlConfig>",
56
- " </Fragment>",
57
- "</Wix>");
58
-
59
- var expected = new[]
60
- {
61
- "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
62
- " <Fragment>",
63
- " <util:XmlConfig Id=\"Change\" ElementPath=\"book\" Value=\"a<>b\" />",
64
- " </Fragment>",
65
- "</Wix>"
66
- };
67
-
68
- var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
69
-
70
- var messaging = new MockMessaging();
71
- var converter = new WixConverter(messaging, 2, null, null);
72
-
73
- var errors = converter.ConvertDocument(document);
74
- Assert.Equal(3, errors);
75
-
76
- var actualLines = UnformattedDocumentLines(document);
77
- WixAssert.CompareLineByLine(expected, actualLines);
78
- }
46
}
47
}
src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
+35
@@ -76,5 +76,40 @@ namespace WixToolsetTest.Converters
76
var actualLines = UnformattedDocumentLines(document);
77
WixAssert.CompareLineByLine(expected, actualLines);
78
}
79
+
80
+ [Fact]
81
+ public void WarnsOnAllRegistryValueSearches()
82
+ {
83
+ var parse = String.Join(Environment.NewLine,
84
+ "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'>",
85
+ " <Fragment>",
86
+ " <util:RegistrySearch Id='RegValue' Root='HKLM' Key='Converter' Variable='Test' />",
87
+ " <util:RegistrySearch Id='RegValue2' Root='HKLM' Key='Converter' Variable='Test' Result='value' />",
88
+ " <util:RegistrySearch Id='RegValue3' Root='HKLM' Key='Converter' Variable='Test' Result='exists' />",
89
+ " </Fragment>",
90
+ "</Wix>");
91
+
92
+ var expected = new[]
93
+ {
94
+ "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\" xmlns:util=\"http://wixtoolset.org/schemas/v4/wxs/util\">",
95
+ " <Fragment>",
96
+ " <util:RegistrySearch Id=\"RegValue\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" />",
97
+ " <util:RegistrySearch Id=\"RegValue2\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"value\" />",
98
+ " <util:RegistrySearch Id=\"RegValue3\" Root=\"HKLM\" Key=\"Converter\" Variable=\"Test\" Result=\"exists\" />",
99
+ " </Fragment>",
100
+ "</Wix>"
101
+ };
102
+
103
+ var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
104
+
105
+ var messaging = new MockMessaging();
106
+ var converter = new WixConverter(messaging, 2, null, null);
107
+
108
+ var errors = converter.ConvertDocument(document);
109
+ Assert.Equal(4, errors);
110
+
111
+ var actualLines = UnformattedDocumentLines(document);
112
+ WixAssert.CompareLineByLine(expected, actualLines);
113
+ }
114
}
115
}