aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WixToolset.Converters/WixConverter.cs24
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs8
-rw-r--r--src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs2
-rw-r--r--src/test/WixToolsetTest.Converters/TagFixture.cs45
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs4
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs4
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs4
-rw-r--r--src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs4
8 files changed, 80 insertions, 15 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs
index 4d5564b4..1ba28df3 100644
--- a/src/WixToolset.Converters/WixConverter.cs
+++ b/src/WixToolset.Converters/WixConverter.cs
@@ -80,6 +80,8 @@ namespace WixToolset.Converters
80 private static readonly XName SetDirectoryElementName = WixNamespace + "SetDirectory"; 80 private static readonly XName SetDirectoryElementName = WixNamespace + "SetDirectory";
81 private static readonly XName SetPropertyElementName = WixNamespace + "SetProperty"; 81 private static readonly XName SetPropertyElementName = WixNamespace + "SetProperty";
82 private static readonly XName ShortcutPropertyElementName = WixNamespace + "ShortcutProperty"; 82 private static readonly XName ShortcutPropertyElementName = WixNamespace + "ShortcutProperty";
83 private static readonly XName SoftwareTagElementName = WixNamespace + "SoftwareTag";
84 private static readonly XName TagElementName = XNamespace.None + "Tag";
83 private static readonly XName TextElementName = WixNamespace + "Text"; 85 private static readonly XName TextElementName = WixNamespace + "Text";
84 private static readonly XName UITextElementName = WixNamespace + "UIText"; 86 private static readonly XName UITextElementName = WixNamespace + "UIText";
85 private static readonly XName VariableElementName = WixNamespace + "Variable"; 87 private static readonly XName VariableElementName = WixNamespace + "Variable";
@@ -117,7 +119,7 @@ namespace WixToolset.Converters
117 { "http://schemas.microsoft.com/wix/NetFxExtension", "http://wixtoolset.org/schemas/v4/wxs/netfx" }, 119 { "http://schemas.microsoft.com/wix/NetFxExtension", "http://wixtoolset.org/schemas/v4/wxs/netfx" },
118 { "http://schemas.microsoft.com/wix/PSExtension", "http://wixtoolset.org/schemas/v4/wxs/powershell" }, 120 { "http://schemas.microsoft.com/wix/PSExtension", "http://wixtoolset.org/schemas/v4/wxs/powershell" },
119 { "http://schemas.microsoft.com/wix/SqlExtension", "http://wixtoolset.org/schemas/v4/wxs/sql" }, 121 { "http://schemas.microsoft.com/wix/SqlExtension", "http://wixtoolset.org/schemas/v4/wxs/sql" },
120 { "http://schemas.microsoft.com/wix/TagExtension", "http://wixtoolset.org/schemas/v4/wxs/tag" }, 122 { "http://schemas.microsoft.com/wix/TagExtension", XNamespace.None },
121 { "http://schemas.microsoft.com/wix/UtilExtension", WixUtilNamespace }, 123 { "http://schemas.microsoft.com/wix/UtilExtension", WixUtilNamespace },
122 { "http://schemas.microsoft.com/wix/VSExtension", "http://wixtoolset.org/schemas/v4/wxs/vs" }, 124 { "http://schemas.microsoft.com/wix/VSExtension", "http://wixtoolset.org/schemas/v4/wxs/vs" },
123 { "http://wixtoolset.org/schemas/thmutil/2010", "http://wixtoolset.org/schemas/v4/thmutil" }, 125 { "http://wixtoolset.org/schemas/thmutil/2010", "http://wixtoolset.org/schemas/v4/thmutil" },
@@ -186,6 +188,7 @@ namespace WixToolset.Converters
186 { WixConverter.SetDirectoryElementName, this.ConvertSetDirectoryElement }, 188 { WixConverter.SetDirectoryElementName, this.ConvertSetDirectoryElement },
187 { WixConverter.SetPropertyElementName, this.ConvertSetPropertyElement }, 189 { WixConverter.SetPropertyElementName, this.ConvertSetPropertyElement },
188 { WixConverter.ShortcutPropertyElementName, this.ConvertShortcutPropertyElement }, 190 { WixConverter.ShortcutPropertyElementName, this.ConvertShortcutPropertyElement },
191 { WixConverter.TagElementName, this.ConvertTagElement },
189 { WixConverter.TextElementName, this.ConvertTextElement }, 192 { WixConverter.TextElementName, this.ConvertTextElement },
190 { WixConverter.UITextElementName, this.ConvertUITextElement }, 193 { WixConverter.UITextElementName, this.ConvertUITextElement },
191 { WixConverter.VariableElementName, this.ConvertVariableElement }, 194 { WixConverter.VariableElementName, this.ConvertVariableElement },
@@ -1144,6 +1147,14 @@ namespace WixToolset.Converters
1144 } 1147 }
1145 } 1148 }
1146 1149
1150 private void ConvertTagElement(XElement element)
1151 {
1152 if (this.OnError(ConverterTestType.TagElementRenamed, element, "The Tag element has been renamed. Use the element 'SoftwareTag' name."))
1153 {
1154 element.Name = SoftwareTagElementName;
1155 }
1156 }
1157
1147 private void ConvertTextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); 1158 private void ConvertTextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
1148 1159
1149 private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); 1160 private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value");
@@ -1378,7 +1389,6 @@ namespace WixToolset.Converters
1378 { 1389 {
1379 foreach (var element in elements) 1390 foreach (var element in elements)
1380 { 1391 {
1381
1382 if (deprecatedToUpdatedNamespaces.TryGetValue(element.Name.Namespace, out var ns)) 1392 if (deprecatedToUpdatedNamespaces.TryGetValue(element.Name.Namespace, out var ns))
1383 { 1393 {
1384 element.Name = ns.GetName(element.Name.LocalName); 1394 element.Name = ns.GetName(element.Name.LocalName);
@@ -1396,6 +1406,11 @@ namespace WixToolset.Converters
1396 { 1406 {
1397 if (deprecatedToUpdatedNamespaces.TryGetValue(attribute.Value, out ns)) 1407 if (deprecatedToUpdatedNamespaces.TryGetValue(attribute.Value, out ns))
1398 { 1408 {
1409 if (ns == XNamespace.None)
1410 {
1411 continue;
1412 }
1413
1399 convertedAttribute = ("xmlns" == attribute.Name.LocalName) ? new XAttribute(attribute.Name.LocalName, ns.NamespaceName) : new XAttribute(XNamespace.Xmlns + attribute.Name.LocalName, ns.NamespaceName); 1414 convertedAttribute = ("xmlns" == attribute.Name.LocalName) ? new XAttribute(attribute.Name.LocalName, ns.NamespaceName) : new XAttribute(XNamespace.Xmlns + attribute.Name.LocalName, ns.NamespaceName);
1400 } 1415 }
1401 } 1416 }
@@ -1815,6 +1830,11 @@ namespace WixToolset.Converters
1815 /// Breaking change: The Win64 attribute's value '{0}' cannot be converted automatically to the new Bitness attribute. 1830 /// Breaking change: The Win64 attribute's value '{0}' cannot be converted automatically to the new Bitness attribute.
1816 /// </summary> 1831 /// </summary>
1817 Win64AttributeRenameCannotBeAutomatic, 1832 Win64AttributeRenameCannotBeAutomatic,
1833
1834 /// <summary>
1835 /// The Tag element has been renamed. Use the element 'SoftwareTag' name.
1836 /// </summary>
1837 TagElementRenamed,
1818 } 1838 }
1819 } 1839 }
1820} 1840}
diff --git a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs b/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs
index 38afca72..cabc89ee 100644
--- a/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs
+++ b/src/test/WixToolsetTest.Converters/ConverterIntegrationFixture.cs
@@ -58,7 +58,7 @@ namespace WixToolsetTest.Converters
58 var converter = new WixConverter(messaging, 4); 58 var converter = new WixConverter(messaging, 4);
59 var errors = converter.ConvertFile(targetFile, true); 59 var errors = converter.ConvertFile(targetFile, true);
60 60
61 Assert.Equal(8, errors); 61 Assert.Equal(9, errors);
62 62
63 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); 63 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
64 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); 64 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
@@ -84,7 +84,7 @@ namespace WixToolsetTest.Converters
84 var settingsFile = Path.Combine(folder, "wixcop.settings.xml"); 84 var settingsFile = Path.Combine(folder, "wixcop.settings.xml");
85 85
86 var result = RunConversion(targetFile, settingsFile: settingsFile); 86 var result = RunConversion(targetFile, settingsFile: settingsFile);
87 Assert.Equal(8, result.ExitCode); 87 Assert.Equal(9, result.ExitCode);
88 88
89 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); 89 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
90 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); 90 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
@@ -108,7 +108,7 @@ namespace WixToolsetTest.Converters
108 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); 108 File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName));
109 109
110 var result = RunConversion(targetFile); 110 var result = RunConversion(targetFile);
111 Assert.Equal(12, result.ExitCode); 111 Assert.Equal(13, result.ExitCode);
112 112
113 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); 113 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
114 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); 114 var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n");
@@ -133,7 +133,7 @@ namespace WixToolsetTest.Converters
133 133
134 var result = RunConversion(targetFile); 134 var result = RunConversion(targetFile);
135 135
136 Assert.Equal(12, result.ExitCode); 136 Assert.Equal(13, result.ExitCode);
137 Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)"))); 137 Assert.Single(result.Messages.Where(message => message.ToString().EndsWith("(QtExecCmdTimeoutAmbiguous)")));
138 138
139 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); 139 var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n");
diff --git a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
index f3437078..a101019b 100644
--- a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
+++ b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs
@@ -9,7 +9,7 @@ namespace WixToolsetTest.Converters
9 using WixToolsetTest.Converters.Mocks; 9 using WixToolsetTest.Converters.Mocks;
10 using Xunit; 10 using Xunit;
11 11
12 public class ExtensionFixture : BaseConverterFixture 12 public class FirewallExtensionFixture : BaseConverterFixture
13 { 13 {
14 [Fact] 14 [Fact]
15 public void FixRemoteAddressValue() 15 public void FixRemoteAddressValue()
diff --git a/src/test/WixToolsetTest.Converters/TagFixture.cs b/src/test/WixToolsetTest.Converters/TagFixture.cs
new file mode 100644
index 00000000..c163ea11
--- /dev/null
+++ b/src/test/WixToolsetTest.Converters/TagFixture.cs
@@ -0,0 +1,45 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolsetTest.Converters
4{
5 using System;
6 using System.Xml.Linq;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Converters;
9 using WixToolsetTest.Converters.Mocks;
10 using Xunit;
11
12 public class TagFixture : BaseConverterFixture
13 {
14 [Fact]
15 public void FixTagExtension()
16 {
17 var parse = String.Join(Environment.NewLine,
18 "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:tag='http://schemas.microsoft.com/wix/TagExtension'>",
19 " <Product>",
20 " <tag:Tag Regid='wixtoolset.org' InstallDirectory='InstallFolder' />",
21 " </Product>",
22 "</Wix>");
23
24 var expected = new[]
25 {
26 "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
27 " <Package>",
28 " <SoftwareTag Regid=\"wixtoolset.org\" InstallDirectory=\"InstallFolder\" />",
29 " </Package>",
30 "</Wix>"
31 };
32
33 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
34
35 var messaging = new MockMessaging();
36 var converter = new WixConverter(messaging, 2, null, null);
37
38 var errors = converter.ConvertDocument(document);
39 Assert.Equal(4, errors);
40
41 var actualLines = UnformattedDocumentLines(document);
42 WixAssert.CompareLineByLine(expected, actualLines);
43 }
44 }
45}
diff --git a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
index b2302b4c..8188d900 100644
--- a/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
+++ b/src/test/WixToolsetTest.Converters/TestData/Preprocessor/ConvertedPreprocessor.wxs
@@ -4,10 +4,10 @@
4 4
5<?include WixVer.wxi ?> 5<?include WixVer.wxi ?>
6 6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200"> 8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9 9
10 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" /> 10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11 11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." /> 12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13 13
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
index f26b5d1a..95d2f618 100644
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
+++ b/src/test/WixToolsetTest.Converters/TestData/QtExec.bad/v4_expected.wxs
@@ -4,10 +4,10 @@
4 4
5<?include WixVer.wxi ?> 5<?include WixVer.wxi ?>
6 6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200"> 8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9 9
10 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" /> 10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11 11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." /> 12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13 13
diff --git a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs b/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
index f5a02e2b..f24d3f8f 100644
--- a/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
+++ b/src/test/WixToolsetTest.Converters/TestData/QtExec/v4_expected.wxs
@@ -4,10 +4,10 @@
4 4
5<?include WixVer.wxi ?> 5<?include WixVer.wxi ?>
6 6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200"> 8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9 9
10 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" /> 10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11 11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." /> 12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13 13
diff --git a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
index 9a83c237..5bcdaf59 100644
--- a/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
+++ b/src/test/WixToolsetTest.Converters/TestData/SingleFile/ConvertedSingleFile.wxs
@@ -4,10 +4,10 @@
4 4
5<?include WixVer.wxi ?> 5<?include WixVer.wxi ?>
6 6
7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 7<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200"> 8 <Package Name="!(loc.ShortProduct) v$(var.WixMajorMinor) Core" Language="1033" Manufacturer="!(loc.Company)" Version="$(var.WixMsiProductVersion)" UpgradeCode="3618724B-2523-44F9-A908-866AA619504D" InstallerVersion="200">
9 9
10 <swid:Tag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" /> 10 <SoftwareTag Regid="!(loc.Regid)" InstallDirectory="INSTALLFOLDER" />
11 11
12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." /> 12 <MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed." />
13 13