Remove warning for `Wix` bundle variable prefix.
It's a bit overzealous. Fixes https://github.com/wixtoolset/issues/issues/7579.
Bob Arnson committed
Jan 1, 2024 at 22:07 UTC
44a13ff738267fc7e1147e46cd86df6cdbba7bb3
8 files changed
+50
-97
src/api/wix/WixToolset.Data/ErrorMessages.cs
+1
-1
@@ -1773,7 +1773,7 @@ namespace WixToolset.Data
1773
1774
public static Message ReservedNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix)
1775
{
1776
- return Message(sourceLineNumbers, Ids.ReservedNamespaceViolation, "The {0}/@{1} attribute's value begins with the reserved prefix '{2}'. Some prefixes are reserved by the Windows Installer and WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.", element, attribute, prefix);
1776
+ return Message(sourceLineNumbers, Ids.ReservedNamespaceViolation, "The {0}/@{1} attribute's value begins with the reserved prefix '{2}'. Some prefixes are reserved by the Windows Installer and WiX Toolset for well-known values. Change your attribute's value to not begin with the same prefix.", element, attribute, prefix);
1777
}
1778
1779
public static Message RootFeatureCannotFollowParent(SourceLineNumber sourceLineNumbers)
src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs
+35
@@ -108,6 +108,41 @@ namespace WixToolsetTest.Netfx
108
}
109
}
110
111
+ [Fact]
112
+ public void CanBuildUsingNetFxSearches()
113
+ {
114
+ using (var fs = new DisposableFileSystem())
115
+ {
116
+ var baseFolder = fs.GetFolder();
117
+ var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
118
+ var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxSearches");
119
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
120
+
121
+ var extensionResult = WixRunner.Execute(warningsAsErrors: true, new[]
122
+ {
123
+ "extension", "add",
124
+ "WixToolset.Bal.wixext",
125
+ "extension", "add",
126
+ "WixToolset.Util.wixext",
127
+ });
128
+
129
+ var compileResult = WixRunner.Execute(new[]
130
+ {
131
+ "build",
132
+ Path.Combine(bundleSourceFolder, "BundleLatest.wxs"),
133
+ "-ext", "WixToolset.Bal.wixext",
134
+ "-ext", "WixToolset.Util.wixext",
135
+ "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"),
136
+ "-intermediateFolder", intermediateFolder,
137
+ "-o", bundleFile,
138
+ "-arch", "x64",
139
+ });
140
+ compileResult.AssertSuccess();
141
+
142
+ Assert.True(File.Exists(bundleFile));
143
+ }
144
+ }
145
+
146
[Fact]
147
public void CanBuildUsingNativeImage()
148
{
src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxSearches/BundleLatest.wxs
new
+13
@@ -0,0 +1,13 @@
1
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2
+ <Bundle Name="NetFxPackageGroup481" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="{1A204524-03F4-4641-BDF3-2A272A34A888}">
3
+ <BootstrapperApplication>
4
+ <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" />
5
+ </BootstrapperApplication>
6
+
7
+ <util:RegistrySearchRef Id="WixNetFramework4xInstalledRelease" />
8
+
9
+ <Chain>
10
+ <PackageGroupRef Id="NetFx481RedistAsPrereq" />
11
+ </Chain>
12
+ </Bundle>
13
+</Wix>
src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs
deleted
-19
@@ -1,19 +0,0 @@
1
-<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2
- <Bundle Name="!(loc.BundleName)" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3
- <BootstrapperApplication>
4
- <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5
- </BootstrapperApplication>
6
-
7
- <util:RegistrySearch
8
- Variable="WixCustomVariable"
9
- Root="HKLM"
10
- Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Custom"
11
- Value="Release"
12
- Result="value"
13
- Bitness="always64" />
14
-
15
- <Chain>
16
- <MsiPackage SourceFile="test.msi" />
17
- </Chain>
18
- </Bundle>
19
-</Wix>
src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
-47
@@ -470,53 +470,6 @@ namespace WixToolsetTest.Util
470
}, results.OrderBy(s => s).ToArray());
471
}
472
473
- [Fact]
474
- public void CanBuildBundleWithWarningsWithSearchesUsingDiscouragedVariableNames()
475
- {
476
- var folder = TestData.Get("TestData", "BundleWithSearches");
477
- var rootFolder = TestData.Get();
478
- var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll");
479
-
480
- using (var fs = new DisposableFileSystem())
481
- {
482
- var baseFolder = fs.GetFolder();
483
- var intermediateFolder = Path.Combine(baseFolder, "obj");
484
- var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
485
- var baFolderPath = Path.Combine(baseFolder, "ba");
486
- var extractFolderPath = Path.Combine(baseFolder, "extract");
487
-
488
- var result = WixRunner.Execute(false, new[]
489
- {
490
- "build",
491
- Path.Combine(folder, "BundleUsingDiscouragedVariableNames.wxs"),
492
- "-ext", wixext,
493
- "-loc", Path.Combine(folder, "Bundle.en-us.wxl"),
494
- "-bindpath", Path.Combine(folder, "data"),
495
- "-intermediateFolder", intermediateFolder,
496
- "-o", bundlePath,
497
- });
498
-
499
- var messages = result.Messages.Select(m => m.ToString()).ToList();
500
- messages.Sort();
501
-
502
- WixAssert.CompareLineByLine(new[]
503
- {
504
- "The *Search/@Variable attribute's value begins with the reserved prefix 'Wix'. Some prefixes are reserved by the WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.",
505
- }, messages.ToArray());
506
-
507
- result.AssertSuccess();
508
-
509
- var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
510
- extractResult.AssertSuccess();
511
-
512
- var utilSearches = extractResult.GetManifestTestXmlLines("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:DirectorySearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]");
513
- WixAssert.CompareLineByLine(new[]
514
- {
515
- @"<RegistrySearch Id='wrsvJmsaXS39nKFUh9CVvRE6SSC4qk' Variable='WixCustomVariable' Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Custom' Value='Release' Win64='yes' Type='value' VariableType='string' />",
516
- }, utilSearches);
517
- }
518
- }
519
-
473
[Fact]
474
public void CannotBuildBundleWithSearchesUsingBuiltinVariableNames()
475
{
src/wix/WixToolset.Core/CompilerWarnings.cs
+1
-6
@@ -46,11 +46,6 @@ namespace WixToolset.Core
46
return Message(sourceLineNumbers, Ids.RequiresKeyNotFound, "The dependency key with identifier {0} was not found in the Wix4Dependency table. Related registry rows will not be removed from authoring.", id);
47
}
48
49
- public static Message ReservedBurnNamespaceWarning(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix)
50
- {
51
- return Message(sourceLineNumbers, Ids.ReservedBurnNamespaceWarning, "The {0}/@{1} attribute's value begins with the reserved prefix '{2}'. Some prefixes are reserved by the WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.", element, attribute, prefix);
52
- }
53
-
49
public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId)
50
{
51
return Message(sourceLineNumbers, Ids.Win64Component, "The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Bitness attribute to \"always32\" to ensure the dependency feature works correctly on legacy operating systems.", componentId);
@@ -71,7 +66,7 @@ namespace WixToolset.Core
66
DirectoryRefStandardDirectoryDeprecated = 5436,
67
DefiningStandardDirectoryDeprecated = 5437,
68
ReadonlyLogVariableTarget = 5438,
74
- ReservedBurnNamespaceWarning = 5439,
69
+ // DO_NOT_REUSE ReservedBurnNamespaceWarning = 5439,
70
} // 5400-5499 and 6600-6699 were the ranges for Dependency and Tag which are now in Core between CompilerWarnings and CompilerErrors.
71
}
72
}
src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs
-22
@@ -192,12 +192,6 @@ namespace WixToolset.Core.ExtensibilityServices
192
193
return false;
194
}
195
- else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase))
196
- {
197
- this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix"));
198
-
199
- return false;
200
- }
195
else
196
{
197
return true;
@@ -242,16 +236,6 @@ namespace WixToolset.Core.ExtensibilityServices
236
237
return allowed;
238
}
245
- else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase))
246
- {
247
- var allowed = nameRule.HasFlag(BundleVariableNameRule.CanHaveReservedPrefix);
248
- if (!allowed)
249
- {
250
- this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix"));
251
- }
252
-
253
- return allowed;
254
- }
239
else
240
{
241
return true;
@@ -291,12 +275,6 @@ namespace WixToolset.Core.ExtensibilityServices
275
{
276
return true;
277
}
294
- else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase))
295
- {
296
- this.Messaging.Write(CompilerWarnings.ReservedBurnNamespaceWarning(sourceLineNumbers, elementName, attributeName, "Wix"));
297
-
298
- return true;
299
- }
278
else
279
{
280
return true;
src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs
-2
@@ -213,7 +213,6 @@ namespace WixToolsetTest.CoreIntegration
213
WixAssert.CompareLineByLine(new[]
214
{
215
"The SetVariable/@Variable attribute's value, 'WixBundleInstalled', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFiles6432Folder', 'CommonFilesFolder', 'CompatibilityMode', 'ComputerName', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProcessorArchitecture', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'SystemLanguageID', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsBuildNumber', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleActiveParent', 'WixBundleCommandLineAction', 'WixBundleElevated', 'WixBundleExecutePackageAction', 'WixBundleExecutePackageCacheFolder', 'WixBundleForcedRestartPackage', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleSourceProcessFolder', 'WixBundleSourceProcessPath', 'WixBundleTag', 'WixBundleUILevel', or 'WixBundleVersion'.",
216
- "The Variable/@Name attribute's value begins with the reserved prefix 'Wix'. Some prefixes are reserved by the WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.",
216
"The Variable/@Name attribute's value, 'AppDataFolder', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFiles6432Folder', 'CommonFilesFolder', 'CompatibilityMode', 'ComputerName', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProcessorArchitecture', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'SystemLanguageID', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsBuildNumber', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleActiveParent', 'WixBundleCommandLineAction', 'WixBundleElevated', 'WixBundleExecutePackageAction', 'WixBundleExecutePackageCacheFolder', 'WixBundleForcedRestartPackage', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleSourceProcessFolder', 'WixBundleSourceProcessPath', 'WixBundleTag', 'WixBundleUILevel', or 'WixBundleVersion'.",
217
}, messages.ToArray());
218
@@ -283,7 +282,6 @@ namespace WixToolsetTest.CoreIntegration
282
"*Search/@Condition contains the built-in Variable 'WixBundleAction', which is not available when it is evaluated. (Unavailable Variables are: 'WixBundleAction'.). Rewrite the condition to avoid Variables that are never valid during its evaluation.",
283
"Bundle/@Condition contains the built-in Variable 'WixBundleInstalled', which is not available when it is evaluated. (Unavailable Variables are: 'RebootPending', 'WixBundleAction', or 'WixBundleInstalled'.). Rewrite the condition to avoid Variables that are never valid during its evaluation.",
284
"ExePackage/@DetectCondition contains the built-in Variable 'WixBundleAction', which is not available when it is evaluated. (Unavailable Variables are: 'WixBundleAction'.). Rewrite the condition to avoid Variables that are never valid during its evaluation.",
286
- "The *Search/@Variable attribute's value begins with the reserved prefix 'Wix'. Some prefixes are reserved by the WiX toolset for well-known values. Change your attribute's value to not begin with the same prefix.",
285
"The *Search/@Variable attribute's value references the well-known log Variable 'WixBundleLog' to change its value. This variable is set by the engine and is intended to be read-only. Change your attribute's value to reference a custom variable.",
286
}, warningMessages);
287