aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Converters/WixConverter.cs38
-rw-r--r--src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs (renamed from src/test/WixToolsetTest.Converters/ExtensionFixture.cs)33
-rw-r--r--src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs35
3 files changed, 71 insertions, 35 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs
index ac63f26b..c713045e 100644
--- a/src/WixToolset.Converters/WixConverter.cs
+++ b/src/WixToolset.Converters/WixConverter.cs
@@ -78,6 +78,7 @@ namespace WixToolset.Converters
78 private static readonly XName VariableElementName = WixNamespace + "Variable"; 78 private static readonly XName VariableElementName = WixNamespace + "Variable";
79 private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication"; 79 private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication";
80 private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx"; 80 private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx";
81 private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch";
81 private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig"; 82 private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig";
82 private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; 83 private static readonly XName CustomActionElementName = WixNamespace + "CustomAction";
83 private static readonly XName PropertyElementName = WixNamespace + "Property"; 84 private static readonly XName PropertyElementName = WixNamespace + "Property";
@@ -151,8 +152,8 @@ namespace WixToolset.Converters
151 { WixConverter.ErrorElementName, this.ConvertErrorElement }, 152 { WixConverter.ErrorElementName, this.ConvertErrorElement },
152 { WixConverter.ExePackageElementName, this.ConvertSuppressSignatureValidation }, 153 { WixConverter.ExePackageElementName, this.ConvertSuppressSignatureValidation },
153 { WixConverter.ModuleElementName, this.ConvertModuleElement }, 154 { WixConverter.ModuleElementName, this.ConvertModuleElement },
154 { WixConverter.MsiPackageElementName, this.ConvertSuppressSignatureValidation }, 155 { WixConverter.MsiPackageElementName, this.ConvertWindowsInstallerPackageElement },
155 { WixConverter.MspPackageElementName, this.ConvertSuppressSignatureValidation }, 156 { WixConverter.MspPackageElementName, this.ConvertWindowsInstallerPackageElement },
156 { WixConverter.MsuPackageElementName, this.ConvertSuppressSignatureValidation }, 157 { WixConverter.MsuPackageElementName, this.ConvertSuppressSignatureValidation },
157 { WixConverter.PayloadElementName, this.ConvertSuppressSignatureValidation }, 158 { WixConverter.PayloadElementName, this.ConvertSuppressSignatureValidation },
158 { WixConverter.PermissionExElementName, this.ConvertPermissionExElement }, 159 { WixConverter.PermissionExElementName, this.ConvertPermissionExElement },
@@ -171,6 +172,7 @@ namespace WixToolset.Converters
171 { WixConverter.VariableElementName, this.ConvertVariableElement }, 172 { WixConverter.VariableElementName, this.ConvertVariableElement },
172 { WixConverter.UtilCloseApplicationElementName, this.ConvertUtilCloseApplicationElementName }, 173 { WixConverter.UtilCloseApplicationElementName, this.ConvertUtilCloseApplicationElementName },
173 { WixConverter.UtilPermissionExElementName, this.ConvertUtilPermissionExElement }, 174 { WixConverter.UtilPermissionExElementName, this.ConvertUtilPermissionExElement },
175 { WixConverter.UtilRegistrySearchName, this.ConvertUtilRegistrySearchElement },
174 { WixConverter.UtilXmlConfigElementName, this.ConvertUtilXmlConfigElement }, 176 { WixConverter.UtilXmlConfigElementName, this.ConvertUtilXmlConfigElement },
175 { WixConverter.PropertyElementName, this.ConvertPropertyElement }, 177 { WixConverter.PropertyElementName, this.ConvertPropertyElement },
176 { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, 178 { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace },
@@ -863,6 +865,16 @@ namespace WixToolset.Converters
863 865
864 private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); 866 private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
865 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
866 private void ConvertCustomActionElement(XElement xCustomAction) 878 private void ConvertCustomActionElement(XElement xCustomAction)
867 { 879 {
868 var xBinaryKey = xCustomAction.Attribute("BinaryKey"); 880 var xBinaryKey = xCustomAction.Attribute("BinaryKey");
@@ -986,6 +998,18 @@ namespace WixToolset.Converters
986 } 998 }
987 } 999 }
988 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
989 private void ConvertUtilXmlConfigElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); 1013 private void ConvertUtilXmlConfigElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
990 1014
991 /// <summary> 1015 /// <summary>
@@ -1422,6 +1446,16 @@ namespace WixToolset.Converters
1422 /// A MediaTemplate with no attributes set is now provided by default. 1446 /// A MediaTemplate with no attributes set is now provided by default.
1423 /// </summary> 1447 /// </summary>
1424 DefaultMediaTemplate, 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,
1425 } 1459 }
1426 } 1460 }
1427} 1461}
diff --git a/src/test/WixToolsetTest.Converters/ExtensionFixture.cs b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
index 4bf2ed3d..f3437078 100644
--- a/src/test/WixToolsetTest.Converters/ExtensionFixture.cs
+++ b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
@@ -43,38 +43,5 @@ namespace WixToolsetTest.Converters
43 var actualLines = UnformattedDocumentLines(document); 43 var actualLines = UnformattedDocumentLines(document);
44 WixAssert.CompareLineByLine(expected, actualLines); 44 WixAssert.CompareLineByLine(expected, actualLines);
45 } 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&lt;>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&lt;&gt;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 }
79 } 46 }
80} 47}
diff --git a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
index 9d55af79..9964e3b0 100644
--- a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
+++ b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs
@@ -76,5 +76,40 @@ namespace WixToolsetTest.Converters
76 var actualLines = UnformattedDocumentLines(document); 76 var actualLines = UnformattedDocumentLines(document);
77 WixAssert.CompareLineByLine(expected, actualLines); 77 WixAssert.CompareLineByLine(expected, actualLines);
78 } 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 }
79 } 114 }
80} 115}