aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-07-21 15:45:16 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-07-21 17:06:01 -0500
commit0fcd544b7d2fbdf37227df055122b17428d9a524 (patch)
tree02edc0006c8f11ce960174c562e9e9c0f63ccfdf
parent913b6238417dceeb8440315e4669990756d17655 (diff)
downloadwix-0fcd544b7d2fbdf37227df055122b17428d9a524.tar.gz
wix-0fcd544b7d2fbdf37227df055122b17428d9a524.tar.bz2
wix-0fcd544b7d2fbdf37227df055122b17428d9a524.zip
Expose and use methods to parse attributes with Burn variable names.
Fixes 6819
-rw-r--r--src/api/wix/WixToolset.Data/ErrorMessages.cs5
-rw-r--r--src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs17
-rw-r--r--src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs3
-rw-r--r--src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs16
-rw-r--r--src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs8
-rw-r--r--src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs1
-rw-r--r--src/ext/Util/wixext/UtilCompiler.cs27
-rw-r--r--src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs4
-rw-r--r--src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs4
-rw-r--r--src/wix/WixToolset.Core/CompilerCore.cs17
-rw-r--r--src/wix/WixToolset.Core/Compiler_Bundle.cs23
-rw-r--r--src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs10
-rw-r--r--src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs26
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs3
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs1
15 files changed, 117 insertions, 48 deletions
diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs
index c28812f7..4826e7c9 100644
--- a/src/api/wix/WixToolset.Data/ErrorMessages.cs
+++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs
@@ -1804,6 +1804,11 @@ namespace WixToolset.Data
1804 return Message(sourceLineNumbers, Ids.RelativePathForRegistryElement, "Cannot convert RelativePath into Registry elements."); 1804 return Message(sourceLineNumbers, Ids.RelativePathForRegistryElement, "Cannot convert RelativePath into Registry elements.");
1805 } 1805 }
1806 1806
1807 public static Message ReservedBurnNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix)
1808 {
1809 return Message(sourceLineNumbers, Ids.ReservedNamespaceViolation, "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);
1810 }
1811
1807 public static Message ReservedNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix) 1812 public static Message ReservedNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix)
1808 { 1813 {
1809 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); 1814 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);
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs
index b8a1923d..ea49da8d 100644
--- a/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs
+++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleVariableSymbol.cs
@@ -35,6 +35,7 @@ namespace WixToolset.Data.Symbols
35 None = 0x0, 35 None = 0x0,
36 Hidden = 0x1, 36 Hidden = 0x1,
37 Persisted = 0x2, 37 Persisted = 0x2,
38 BuiltIn = 0x4,
38 } 39 }
39 40
40 public enum WixBundleVariableType 41 public enum WixBundleVariableType
@@ -107,5 +108,21 @@ namespace WixToolset.Data.Symbols
107 } 108 }
108 } 109 }
109 } 110 }
111
112 public bool BuiltIn
113 {
114 get { return this.Attributes.HasFlag(WixBundleVariableAttributes.BuiltIn); }
115 set
116 {
117 if (value)
118 {
119 this.Attributes |= WixBundleVariableAttributes.BuiltIn;
120 }
121 else
122 {
123 this.Attributes &= ~WixBundleVariableAttributes.BuiltIn;
124 }
125 }
126 }
110 } 127 }
111} 128}
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs
index fc88a443..43f65fc8 100644
--- a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs
+++ b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs
@@ -39,8 +39,9 @@ namespace WixToolset.Extensibility.Services
39 /// <param name="elementName"></param> 39 /// <param name="elementName"></param>
40 /// <param name="attributeName"></param> 40 /// <param name="attributeName"></param>
41 /// <param name="variableName"></param> 41 /// <param name="variableName"></param>
42 /// <param name="allowBuiltIn">Whether to bypass checks for reserved values.</param>
42 /// <returns>Whether the name is valid.</returns> 43 /// <returns>Whether the name is valid.</returns>
43 bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName); 44 bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn);
44 45
45 /// <summary> 46 /// <summary>
46 /// Validates a bundle condition and displays an error for an illegal value. 47 /// Validates a bundle condition and displays an error for an illegal value.
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs
index 546a43a7..a8246b9b 100644
--- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs
+++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs
@@ -234,6 +234,22 @@ namespace WixToolset.Extensibility.Services
234 string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly); 234 string GetAttributeValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, EmptyRule emptyRule = EmptyRule.CanBeWhitespaceOnly);
235 235
236 /// <summary> 236 /// <summary>
237 /// Gets a bundle variable name identifier and displays an error for an illegal value.
238 /// </summary>
239 /// <param name="sourceLineNumbers">Source line information about the owner element.</param>
240 /// <param name="attribute">The attribute containing the value to get.</param>
241 /// <returns>The attribute's identifier value or a special value if an error occurred.</returns>
242 Identifier GetAttributeBundleVariableNameIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute);
243
244 /// <summary>
245 /// Gets a bundle variable name value and displays an error for an illegal value.
246 /// </summary>
247 /// <param name="sourceLineNumbers">Source line information about the owner element.</param>
248 /// <param name="attribute">The attribute containing the value to get.</param>
249 /// <returns>The attribute's value.</returns>
250 string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute);
251
252 /// <summary>
237 /// Get a guid attribute value and displays an error for an illegal guid value. 253 /// Get a guid attribute value and displays an error for an illegal guid value.
238 /// </summary> 254 /// </summary>
239 /// <param name="sourceLineNumbers">Source line information about the owner element.</param> 255 /// <param name="sourceLineNumbers">Source line information about the owner element.</param>
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs
index e0dfc1b8..cc7162d7 100644
--- a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs
+++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingBuiltinVariableNames.wxs
@@ -37,6 +37,14 @@
37 Value="Release" 37 Value="Release"
38 Result="value" 38 Result="value"
39 Bitness="always64" /> 39 Bitness="always64" />
40
41 <util:RegistrySearch
42 Variable="WixCustomVariable"
43 Root="HKLM"
44 Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Custom"
45 Value="Release"
46 Result="value"
47 Bitness="always64" />
40 </Fragment> 48 </Fragment>
41 49
42 <Fragment> 50 <Fragment>
diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
index 9cb94b61..39b792b7 100644
--- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs
@@ -328,6 +328,7 @@ namespace WixToolsetTest.Util
328 "The DirectorySearch/@Variable attribute's value, 'InstallerName', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 328 "The DirectorySearch/@Variable attribute's value, 'InstallerName', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
329 "The FileSearch/@Variable attribute's value, 'NativeMachine', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 329 "The FileSearch/@Variable attribute's value, 'NativeMachine', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
330 "The ProductSearch/@Variable attribute's value, 'Date', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 330 "The ProductSearch/@Variable attribute's value, 'Date', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
331 "The RegistrySearch/@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.",
331 "The RegistrySearch/@Variable attribute's value, 'VersionNT64', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 332 "The RegistrySearch/@Variable attribute's value, 'VersionNT64', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
332 "The RegistrySearch/@Variable attribute's value, 'WixBundleAction', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 333 "The RegistrySearch/@Variable attribute's value, 'WixBundleAction', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
333 "The WindowsFeatureSearch/@Variable attribute's value, 'NTProductType', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 334 "The WindowsFeatureSearch/@Variable attribute's value, 'NTProductType', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs
index d770555f..a6e4b835 100644
--- a/src/ext/Util/wixext/UtilCompiler.cs
+++ b/src/ext/Util/wixext/UtilCompiler.cs
@@ -415,8 +415,7 @@ namespace WixToolset.Util
415 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); 415 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
416 break; 416 break;
417 case "Variable": 417 case "Variable":
418 variable = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 418 variable = this.ParseHelper.GetAttributeBundleVariableNameValue(sourceLineNumbers, attrib);
419 // TODO: handle standard bundle variables
420 break; 419 break;
421 case "Condition": 420 case "Condition":
422 condition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); 421 condition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
@@ -505,10 +504,10 @@ namespace WixToolset.Util
505 504
506 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 505 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
507 506
508 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
509
510 if (!this.Messaging.EncounteredError) 507 if (!this.Messaging.EncounteredError)
511 { 508 {
509 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
510
512 section.AddSymbol(new WixComponentSearchSymbol(sourceLineNumbers, id) 511 section.AddSymbol(new WixComponentSearchSymbol(sourceLineNumbers, id)
513 { 512 {
514 Guid = guid, 513 Guid = guid,
@@ -616,10 +615,10 @@ namespace WixToolset.Util
616 this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), element.Name.LocalName)); 615 this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), element.Name.LocalName));
617 } 616 }
618 617
619 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, bundleExtensionId);
620
621 if (!this.Messaging.EncounteredError) 618 if (!this.Messaging.EncounteredError)
622 { 619 {
620 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, bundleExtensionId);
621
623 section.AddSymbol(new WixWindowsFeatureSearchSymbol(sourceLineNumbers, id) 622 section.AddSymbol(new WixWindowsFeatureSearchSymbol(sourceLineNumbers, id)
624 { 623 {
625 Type = feature, 624 Type = feature,
@@ -1043,10 +1042,10 @@ namespace WixToolset.Util
1043 1042
1044 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 1043 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
1045 1044
1046 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
1047
1048 if (!this.Messaging.EncounteredError) 1045 if (!this.Messaging.EncounteredError)
1049 { 1046 {
1047 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
1048
1050 this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); 1049 this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type);
1051 } 1050 }
1052 } 1051 }
@@ -1157,10 +1156,10 @@ namespace WixToolset.Util
1157 1156
1158 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); 1157 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);
1159 1158
1160 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, node.Name.LocalName, id, variable, condition, after, null);
1161
1162 if (!this.Messaging.EncounteredError) 1159 if (!this.Messaging.EncounteredError)
1163 { 1160 {
1161 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, node.Name.LocalName, id, variable, condition, after, null);
1162
1164 this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); 1163 this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type);
1165 } 1164 }
1166 } 1165 }
@@ -2645,10 +2644,10 @@ namespace WixToolset.Util
2645 2644
2646 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 2645 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
2647 2646
2648 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
2649
2650 if (!this.Messaging.EncounteredError) 2647 if (!this.Messaging.EncounteredError)
2651 { 2648 {
2649 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
2650
2652 section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id) 2651 section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id)
2653 { 2652 {
2654 Guid = guid, 2653 Guid = guid,
@@ -2777,10 +2776,10 @@ namespace WixToolset.Util
2777 2776
2778 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); 2777 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
2779 2778
2780 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
2781
2782 if (!this.Messaging.EncounteredError) 2779 if (!this.Messaging.EncounteredError)
2783 { 2780 {
2781 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null);
2782
2784 section.AddSymbol(new WixRegistrySearchSymbol(sourceLineNumbers, id) 2783 section.AddSymbol(new WixRegistrySearchSymbol(sourceLineNumbers, id)
2785 { 2784 {
2786 Root = root.Value, 2785 Root = root.Value,
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs
index cc3c22db..90c6e3dc 100644
--- a/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs
+++ b/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs
@@ -163,7 +163,7 @@ namespace WixToolset.Core.Burn.Bundles
163 163
164 private void ValidateSearch(WixSearchSymbol symbol) 164 private void ValidateSearch(WixSearchSymbol symbol)
165 { 165 {
166 this.BackendHelper.ValidateBundleVariableName(symbol.SourceLineNumbers, "*Search", "Variable", symbol.Variable); 166 this.BackendHelper.ValidateBundleVariableName(symbol.SourceLineNumbers, "*Search", "Variable", symbol.Variable, allowBuiltIn: false);
167 167
168 if (symbol.Condition != null) 168 if (symbol.Condition != null)
169 { 169 {
@@ -173,7 +173,7 @@ namespace WixToolset.Core.Burn.Bundles
173 173
174 private void ValidateVariable(WixBundleVariableSymbol symbol) 174 private void ValidateVariable(WixBundleVariableSymbol symbol)
175 { 175 {
176 this.BackendHelper.ValidateBundleVariableName(symbol.SourceLineNumbers, "Variable", "Name", symbol.Id.Id); 176 this.BackendHelper.ValidateBundleVariableName(symbol.SourceLineNumbers, "Variable", "Name", symbol.Id.Id, allowBuiltIn: symbol.BuiltIn);
177 } 177 }
178 } 178 }
179} 179}
diff --git a/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs b/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs
index e267369f..58fdeca5 100644
--- a/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs
+++ b/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs
@@ -190,9 +190,9 @@ namespace WixToolset.Core.Burn.ExtensibilityServices
190 return this.bundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, elementName, attributeName, propertyName); 190 return this.bundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, elementName, attributeName, propertyName);
191 } 191 }
192 192
193 public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) 193 public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn)
194 { 194 {
195 return this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName); 195 return this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName, allowBuiltIn);
196 } 196 }
197 197
198 public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase) 198 public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase)
diff --git a/src/wix/WixToolset.Core/CompilerCore.cs b/src/wix/WixToolset.Core/CompilerCore.cs
index cda6507a..cbb8f1f0 100644
--- a/src/wix/WixToolset.Core/CompilerCore.cs
+++ b/src/wix/WixToolset.Core/CompilerCore.cs
@@ -744,19 +744,12 @@ namespace WixToolset.Core
744 /// <returns>The attribute's value.</returns> 744 /// <returns>The attribute's value.</returns>
745 public Identifier GetAttributeBundleVariableNameIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute) 745 public Identifier GetAttributeBundleVariableNameIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute)
746 { 746 {
747 var variableName = this.GetAttributeIdentifier(sourceLineNumbers, attribute); 747 return this.parseHelper.GetAttributeBundleVariableNameIdentifier(sourceLineNumbers, attribute);
748 748 }
749 if (!String.IsNullOrEmpty(variableName?.Id))
750 {
751 this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableName.Id);
752
753 if (variableName.Id.StartsWith("Wix", StringComparison.OrdinalIgnoreCase))
754 {
755 this.messaging.Write(ErrorMessages.ReservedNamespaceViolation(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, "Wix"));
756 }
757 }
758 749
759 return variableName; 750 public string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute)
751 {
752 return this.parseHelper.GetAttributeBundleVariableNameValue(sourceLineNumbers, attribute);
760 } 753 }
761 754
762 /// <summary> 755 /// <summary>
diff --git a/src/wix/WixToolset.Core/Compiler_Bundle.cs b/src/wix/WixToolset.Core/Compiler_Bundle.cs
index 376d0150..d6b00943 100644
--- a/src/wix/WixToolset.Core/Compiler_Bundle.cs
+++ b/src/wix/WixToolset.Core/Compiler_Bundle.cs
@@ -462,35 +462,32 @@ namespace WixToolset.Core
462 Type = ContainerType.Attached, 462 Type = ContainerType.Attached,
463 }); 463 });
464 464
465 var wellKnownVariableAttributes = WixBundleVariableAttributes.Persisted | WixBundleVariableAttributes.BuiltIn;
466
465 // Ensure that the bundle stores the well-known persisted values. 467 // Ensure that the bundle stores the well-known persisted values.
466 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_INPROGRESS_NAME)) 468 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_INPROGRESS_NAME))
467 { 469 {
468 Hidden = false, 470 Attributes = wellKnownVariableAttributes,
469 Persisted = true,
470 }); 471 });
471 472
472 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_NAME)) 473 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_NAME))
473 { 474 {
474 Hidden = false, 475 Attributes = wellKnownVariableAttributes,
475 Persisted = true,
476 }); 476 });
477 477
478 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE)) 478 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE))
479 { 479 {
480 Hidden = false, 480 Attributes = wellKnownVariableAttributes,
481 Persisted = true,
482 }); 481 });
483 482
484 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER)) 483 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER))
485 { 484 {
486 Hidden = false, 485 Attributes = wellKnownVariableAttributes,
487 Persisted = true,
488 }); 486 });
489 487
490 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE)) 488 this.Core.AddSymbol(new WixBundleVariableSymbol(sourceLineNumbers, new Identifier(AccessModifier.Section, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE))
491 { 489 {
492 Hidden = false, 490 Attributes = wellKnownVariableAttributes,
493 Persisted = true,
494 }); 491 });
495 } 492 }
496 } 493 }
@@ -3620,7 +3617,7 @@ namespace WixToolset.Core
3620 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 3617 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
3621 break; 3618 break;
3622 case "Variable": 3619 case "Variable":
3623 variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3620 variable = this.Core.GetAttributeBundleVariableNameValue(sourceLineNumbers, attrib);
3624 break; 3621 break;
3625 case "Condition": 3622 case "Condition":
3626 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3623 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -3655,10 +3652,10 @@ namespace WixToolset.Core
3655 id = this.Core.CreateIdentifier("sbv", variable, condition, after, value, type.ToString()); 3652 id = this.Core.CreateIdentifier("sbv", variable, condition, after, value, type.ToString());
3656 } 3653 }
3657 3654
3658 this.Core.CreateWixSearchSymbol(sourceLineNumbers, node.Name.LocalName, id, variable, condition, after);
3659
3660 if (!this.Messaging.EncounteredError) 3655 if (!this.Messaging.EncounteredError)
3661 { 3656 {
3657 this.Core.CreateWixSearchSymbol(sourceLineNumbers, node.Name.LocalName, id, variable, condition, after);
3658
3662 this.Core.AddSymbol(new WixSetVariableSymbol(sourceLineNumbers, id) 3659 this.Core.AddSymbol(new WixSetVariableSymbol(sourceLineNumbers, id)
3663 { 3660 {
3664 Value = value, 3661 Value = value,
diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs
index 44b3ea93..5c4030e4 100644
--- a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs
+++ b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs
@@ -145,7 +145,7 @@ namespace WixToolset.Core.ExtensibilityServices
145 return relativePath; 145 return relativePath;
146 } 146 }
147 147
148 public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) 148 public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn)
149 { 149 {
150 if (String.IsNullOrEmpty(variableName)) 150 if (String.IsNullOrEmpty(variableName))
151 { 151 {
@@ -159,13 +159,19 @@ namespace WixToolset.Core.ExtensibilityServices
159 159
160 return false; 160 return false;
161 } 161 }
162 else if (BuiltinBundleVariables.Contains(variableName)) 162 else if (!allowBuiltIn && BuiltinBundleVariables.Contains(variableName))
163 { 163 {
164 var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables); 164 var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables);
165 this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); 165 this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues));
166 166
167 return false; 167 return false;
168 } 168 }
169 else if (!allowBuiltIn && variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase))
170 {
171 this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix"));
172
173 return false;
174 }
169 else 175 else
170 { 176 {
171 return true; 177 return true;
diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
index a885e7af..31607b02 100644
--- a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+++ b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
@@ -248,7 +248,7 @@ namespace WixToolset.Core.ExtensibilityServices
248 } 248 }
249 else 249 else
250 { 250 {
251 this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, "Variable", variable); 251 this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, "Variable", variable, allowBuiltIn: false);
252 } 252 }
253 253
254 section.AddSymbol(new WixSearchSymbol(sourceLineNumbers, id) 254 section.AddSymbol(new WixSearchSymbol(sourceLineNumbers, id)
@@ -316,6 +316,30 @@ namespace WixToolset.Core.ExtensibilityServices
316 }); 316 });
317 } 317 }
318 318
319 public Identifier GetAttributeBundleVariableNameIdentifier(SourceLineNumber sourceLineNumbers, XAttribute attribute)
320 {
321 var variableId = this.GetAttributeIdentifier(sourceLineNumbers, attribute);
322
323 if (!String.IsNullOrEmpty(variableId?.Id))
324 {
325 this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableId.Id, allowBuiltIn: false);
326 }
327
328 return variableId;
329 }
330
331 public string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute)
332 {
333 var variableName = this.GetAttributeValue(sourceLineNumbers, attribute);
334
335 if (!String.IsNullOrEmpty(variableName))
336 {
337 this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableName, allowBuiltIn: false);
338 }
339
340 return variableName;
341 }
342
319 public string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false) 343 public string GetAttributeGuidValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool generatable = false, bool canBeEmpty = false)
320 { 344 {
321 if (null == attribute) 345 if (null == attribute)
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs
index 4d308fa5..e82b985f 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs
@@ -212,8 +212,9 @@ namespace WixToolsetTest.CoreIntegration
212 212
213 WixAssert.CompareLineByLine(new[] 213 WixAssert.CompareLineByLine(new[]
214 { 214 {
215 "The SetVariable/@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.",
215 "The SetVariable/@Variable attribute's value, 'WixBundleInstalled', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 216 "The SetVariable/@Variable attribute's value, 'WixBundleInstalled', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
216 "The Variable/@Name attribute's value begins with the reserved prefix 'Wix'. 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.", 217 "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.",
217 "The Variable/@Name attribute's value, 'AppDataFolder', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.", 218 "The Variable/@Name attribute's value, 'AppDataFolder', is one of the illegal options: 'AdminToolsFolder', 'AppDataFolder', 'CommonAppDataFolder', 'CommonFiles64Folder', 'CommonFilesFolder', 'CompatibilityMode', 'Date', 'DesktopFolder', 'FavoritesFolder', 'FontsFolder', 'InstallerName', 'InstallerVersion', 'LocalAppDataFolder', 'LogonUser', 'MyPicturesFolder', 'NativeMachine', 'NTProductType', 'NTSuiteBackOffice', 'NTSuiteDataCenter', 'NTSuiteEnterprise', 'NTSuitePersonal', 'NTSuiteSmallBusiness', 'NTSuiteSmallBusinessRestricted', 'NTSuiteWebServer', 'PersonalFolder', 'Privileged', 'ProgramFiles64Folder', 'ProgramFiles6432Folder', 'ProgramFilesFolder', 'ProgramMenuFolder', 'RebootPending', 'SendToFolder', 'ServicePackLevel', 'StartMenuFolder', 'StartupFolder', 'System64Folder', 'SystemFolder', 'TempFolder', 'TemplateFolder', 'TerminalServer', 'UserLanguageID', 'UserUILanguageID', 'VersionMsi', 'VersionNT', 'VersionNT64', 'WindowsFolder', 'WindowsVolume', 'WixBundleAction', 'WixBundleCommandLineAction', 'WixBundleForcedRestartPackage', 'WixBundleElevated', 'WixBundleInstalled', 'WixBundleProviderKey', 'WixBundleTag', or 'WixBundleVersion'.",
218 }, messages.ToArray()); 219 }, messages.ToArray());
219 220
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs
index af0e6625..3a38e2c9 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs
@@ -1,6 +1,7 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> 1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Fragment> 2 <Fragment>
3 <SetVariable Id="Builtin" Variable="WixBundleInstalled" Value="1" /> 3 <SetVariable Id="Builtin" Variable="WixBundleInstalled" Value="1" />
4 <SetVariable Id="Builtin" Variable="WixDoesNotExist" Value="2" />
4 <Variable Name="WixCustomVariable" /> 5 <Variable Name="WixCustomVariable" />
5 <Variable Name="AppDataFolder" /> 6 <Variable Name="AppDataFolder" />
6 </Fragment> 7 </Fragment>