Warn about new InstallerVersion default.
Bob Arnson committed
Nov 4, 2020 at 19:10 UTC
6a96c2ee082c37fd12d071514cab450f0c18618a
3 files changed
+44
-4
src/WixToolset.Converters/WixConverter.cs
+17
@@ -687,6 +687,12 @@ namespace WixToolset.Converters
687
{
688
xSummaryInformation.Name = SummaryInformationElementName;
689
690
+ var xInstallerVersion = xSummaryInformation.Attribute("InstallerVersion");
691
+ if (this.SourceVersion < 4 && xInstallerVersion == null)
692
+ {
693
+ this.OnError(ConverterTestType.InstallerVersionBehaviorChange, element, "Breaking change: The default value for Package/@InstallerVersion has been changed to '500' regardless of build platform. If you need a lower version, set it manually in the Module element.");
694
+ }
695
+
696
RemoveAttribute(xSummaryInformation, "AdminImage");
697
RemoveAttribute(xSummaryInformation, "Comments");
698
MoveAttribute(xSummaryInformation, "Id", xModule, "Guid");
@@ -750,6 +756,12 @@ namespace WixToolset.Converters
756
{
757
xSummaryInformation.Name = SummaryInformationElementName;
758
759
+ var xInstallerVersion = xSummaryInformation.Attribute("InstallerVersion");
760
+ if (this.SourceVersion < 4 && xInstallerVersion == null)
761
+ {
762
+ this.OnError(ConverterTestType.InstallerVersionBehaviorChange, element, "Breaking change: The default value for Package/@InstallerVersion has been changed to '500' regardless of build platform. If you need a lower version, set it manually in the Package element.");
763
+ }
764
+
765
RemoveAttribute(xSummaryInformation, "AdminImage");
766
RemoveAttribute(xSummaryInformation, "Comments");
767
MoveAttribute(xSummaryInformation, "Compressed", xPackage, defaultValue: "no");
@@ -1456,6 +1468,11 @@ namespace WixToolset.Converters
1468
/// DisplayInternalUI can't be converted.
1469
/// </summary>
1470
DisplayInternalUiNotConvertable,
1471
+
1472
+ /// <summary>
1473
+ /// InstallerVersion has breaking change when missing.
1474
+ /// </summary>
1475
+ InstallerVersionBehaviorChange,
1476
}
1477
}
1478
}
src/test/WixToolsetTest.Converters/ConditionFixture.cs
+1
-1
@@ -247,7 +247,7 @@ namespace WixToolsetTest.Converters
247
var converter = new WixConverter(messaging, 2, null, null);
248
249
var errors = converter.ConvertDocument(document);
250
- Assert.Equal(5, errors);
250
+ Assert.Equal(6, errors);
251
252
var actualLines = UnformattedDocumentLines(document);
253
WixAssert.CompareLineByLine(expected, actualLines);
src/test/WixToolsetTest.Converters/ProductPackageFixture.cs
+26
-3
@@ -33,7 +33,7 @@ namespace WixToolsetTest.Converters
33
"</Wix>"
34
};
35
36
- AssertSuccess(parse, 3, expected);
36
+ AssertSuccess(parse, 4, expected);
37
}
38
39
private static void AssertSuccess(string input, int expectedErrorCount, string[] expected)
@@ -96,6 +96,29 @@ namespace WixToolsetTest.Converters
96
AssertSuccess(parse, 3, expected);
97
}
98
99
+ [Fact]
100
+ public void FixesImplicitInstallerVersion()
101
+ {
102
+ var parse = String.Join(Environment.NewLine,
103
+ "<?xml version=\"1.0\" encoding=\"utf-16\"?>",
104
+ "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>",
105
+ " <Product>",
106
+ " <Package />",
107
+ " </Product>",
108
+ "</Wix>");
109
+
110
+ var expected = new[]
111
+ {
112
+ "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
113
+ " <Package>",
114
+ " ",
115
+ " </Package>",
116
+ "</Wix>"
117
+ };
118
+
119
+ AssertSuccess(parse, 4, expected);
120
+ }
121
+
122
[Fact]
123
public void FixesNonDefaultInstallerVersion()
124
{
@@ -139,7 +162,7 @@ namespace WixToolsetTest.Converters
162
"</Wix>"
163
};
164
142
- AssertSuccess(parse, 3, expected);
165
+ AssertSuccess(parse, 4, expected);
166
}
167
168
[Fact]
@@ -164,7 +187,7 @@ namespace WixToolsetTest.Converters
187
"</Wix>"
188
};
189
167
- AssertSuccess(parse, 3, expected);
190
+ AssertSuccess(parse, 4, expected);
191
}
192
193
[Fact]