aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2023-02-09 07:42:00 -0800
committerRob Mensching <rob@firegiant.com>2023-02-09 15:18:09 -0800
commit4d0b22438b5795e7a92c227f1c824b8da853d859 (patch)
tree5c3626b2345de83c5224e15d1ae477fc26750b85
parent667d3164653ed53d618baba6f41fc00e7eb1a031 (diff)
downloadwix-4d0b22438b5795e7a92c227f1c824b8da853d859.tar.gz
wix-4d0b22438b5795e7a92c227f1c824b8da853d859.tar.bz2
wix-4d0b22438b5795e7a92c227f1c824b8da853d859.zip
Add converter error message when TARGETDIR ref is removed
Fixes 7187
-rw-r--r--src/wix/WixToolset.Converters/WixConverter.cs7
-rw-r--r--src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs2
-rw-r--r--src/wix/test/WixToolsetTest.Converters/DirectoryFixture.cs11
3 files changed, 17 insertions, 3 deletions
diff --git a/src/wix/WixToolset.Converters/WixConverter.cs b/src/wix/WixToolset.Converters/WixConverter.cs
index f962dc9c..460bb3af 100644
--- a/src/wix/WixToolset.Converters/WixConverter.cs
+++ b/src/wix/WixToolset.Converters/WixConverter.cs
@@ -1123,6 +1123,8 @@ namespace WixToolset.Converters
1123 if (this.OnInformation(ConverterTestType.StandardDirectoryRefDeprecated, element, "The {0} directory should no longer be explicitly referenced. Remove the DirectoryRef element with Id attribute '{0}'.", id)) 1123 if (this.OnInformation(ConverterTestType.StandardDirectoryRefDeprecated, element, "The {0} directory should no longer be explicitly referenced. Remove the DirectoryRef element with Id attribute '{0}'.", id))
1124 { 1124 {
1125 RemoveElementKeepChildren(element); 1125 RemoveElementKeepChildren(element);
1126
1127 this.OnError(ConverterTestType.TargetDirRefRemoved, element, "A reference to the TARGETDIR Directory was removed. This may cause the Fragment that defined TARGETDIR to not be included in the final output. If this happens, reference a different element in the Fragment to replace the old reference to TARGEDIR.");
1126 } 1128 }
1127 } 1129 }
1128 else if (this.OnInformation(ConverterTestType.StandardDirectoryRefDeprecated, element, "The standard directory '{0}' should no longer be directly referenced. Use the StandardDirectory element instead.", id)) 1130 else if (this.OnInformation(ConverterTestType.StandardDirectoryRefDeprecated, element, "The standard directory '{0}' should no longer be directly referenced. Use the StandardDirectory element instead.", id))
@@ -3300,6 +3302,11 @@ namespace WixToolset.Converters
3300 /// The magic WixVariable 'WixMbaPrereqPackageId' has been removed. Add bal:PrereqPackage="yes" to the target package instead. 3302 /// The magic WixVariable 'WixMbaPrereqPackageId' has been removed. Add bal:PrereqPackage="yes" to the target package instead.
3301 /// </summary> 3303 /// </summary>
3302 WixMbaPrereqPackageIdDeprecated, 3304 WixMbaPrereqPackageIdDeprecated,
3305
3306 /// <summary>
3307 /// A reference to the TARGETDIR Directory was removed. This may cause the Fragment that defined TARGETDIR to not be included in the final output. If this happens, reference a different element in the Fragment to replace the old reference to TARGEDIR.
3308 /// </summary>
3309 TargetDirRefRemoved,
3303 } 3310 }
3304 } 3311 }
3305} 3312}
diff --git a/src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs
index 7aa1c959..736229da 100644
--- a/src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs
+++ b/src/wix/test/WixToolsetTest.Converters/ConverterFixture.cs
@@ -298,7 +298,7 @@ namespace WixToolsetTest.Converters
298 298
299 WixAssert.CompareLineByLine(expected, actual); 299 WixAssert.CompareLineByLine(expected, actual);
300 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace()); 300 Assert.Equal(Wix4Namespace, document.Root.GetDefaultNamespace());
301 Assert.Equal(3, errors); 301 Assert.Equal(4, errors);
302 } 302 }
303 303
304 [Fact] 304 [Fact]
diff --git a/src/wix/test/WixToolsetTest.Converters/DirectoryFixture.cs b/src/wix/test/WixToolsetTest.Converters/DirectoryFixture.cs
index e992bf30..c938b9ad 100644
--- a/src/wix/test/WixToolsetTest.Converters/DirectoryFixture.cs
+++ b/src/wix/test/WixToolsetTest.Converters/DirectoryFixture.cs
@@ -89,7 +89,14 @@ namespace WixToolsetTest.Converters
89 89
90 var actualLines = UnformattedDocumentLines(document); 90 var actualLines = UnformattedDocumentLines(document);
91 WixAssert.CompareLineByLine(expected, actualLines); 91 WixAssert.CompareLineByLine(expected, actualLines);
92 Assert.Equal(3, errors); 92 WixAssert.CompareLineByLine(new[]
93 {
94 "[Converted] This file contains an XML declaration on the first line. (DeclarationPresent)",
95 "[Converted] The namespace 'http://schemas.microsoft.com/wix/2006/wi' is out of date. It must be 'http://wixtoolset.org/schemas/v4/wxs'. (XmlnsValueWrong)",
96 "[Converted] The TARGETDIR directory should no longer be explicitly referenced. Remove the DirectoryRef element with Id attribute 'TARGETDIR'. (StandardDirectoryRefDeprecated)",
97 "A reference to the TARGETDIR Directory was removed. This may cause the Fragment that defined TARGETDIR to not be included in the final output. If this happens, reference a different element in the Fragment to replace the old reference to TARGEDIR. (TargetDirRefRemoved)",
98 }, messaging.Messages.Select(m => m.ToString()).ToArray());
99 Assert.Equal(4, errors);
93 } 100 }
94 101
95 [Fact] 102 [Fact]
@@ -201,7 +208,7 @@ namespace WixToolsetTest.Converters
201 208
202 var actualLines = UnformattedDocumentLines(document); 209 var actualLines = UnformattedDocumentLines(document);
203 WixAssert.CompareLineByLine(expected, actualLines); 210 WixAssert.CompareLineByLine(expected, actualLines);
204 Assert.Equal(4, errors); 211 Assert.Equal(5, errors);
205 } 212 }
206 213
207 [Fact] 214 [Fact]