diff options
Diffstat (limited to 'src')
15 files changed, 333 insertions, 35 deletions
diff --git a/src/api/wix/WixToolset.Extensibility/Data/BundleVariableNameRule.cs b/src/api/wix/WixToolset.Extensibility/Data/BundleVariableNameRule.cs new file mode 100644 index 00000000..eb6f7543 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/BundleVariableNameRule.cs | |||
| @@ -0,0 +1,33 @@ | |||
| 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 | |||
| 3 | namespace WixToolset.Extensibility.Data | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// When validating a bundle variable name, which special restrictions to ignore. | ||
| 9 | /// </summary> | ||
| 10 | [Flags] | ||
| 11 | public enum BundleVariableNameRule | ||
| 12 | { | ||
| 13 | /// <summary> | ||
| 14 | /// Enforce all special restrictions. | ||
| 15 | /// </summary> | ||
| 16 | EnforceAllRestrictions = 0x0, | ||
| 17 | |||
| 18 | /// <summary> | ||
| 19 | /// Allow names of built-in variables. | ||
| 20 | /// </summary> | ||
| 21 | CanBeBuiltIn = 0x1, | ||
| 22 | |||
| 23 | /// <summary> | ||
| 24 | /// Allow names of well-known variables. | ||
| 25 | /// </summary> | ||
| 26 | CanBeWellKnown = 0x2, | ||
| 27 | |||
| 28 | /// <summary> | ||
| 29 | /// Allow names that are not built-in and are not well-known and start with 'Wix'. | ||
| 30 | /// </summary> | ||
| 31 | CanHaveReservedPrefix = 0x4, | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs index 43f65fc8..3753d16d 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IBundleValidator.cs | |||
| @@ -33,15 +33,35 @@ namespace WixToolset.Extensibility.Services | |||
| 33 | bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName); | 33 | bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName); |
| 34 | 34 | ||
| 35 | /// <summary> | 35 | /// <summary> |
| 36 | /// Validates a Bundle variable name and displays an error for an illegal value. | 36 | /// Validates a Bundle variable name that is being used to declare a Variable in the bundle manifest and displays an error for an illegal value. |
| 37 | /// </summary> | 37 | /// </summary> |
| 38 | /// <param name="sourceLineNumbers"></param> | 38 | /// <param name="sourceLineNumbers"></param> |
| 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> | ||
| 43 | /// <returns>Whether the name is valid.</returns> | 42 | /// <returns>Whether the name is valid.</returns> |
| 44 | bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn); | 43 | bool ValidateBundleVariableNameDeclaration(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName); |
| 44 | |||
| 45 | /// <summary> | ||
| 46 | /// Validates a Bundle variable name that is being used to reference a Variable and displays an error for an illegal value. | ||
| 47 | /// </summary> | ||
| 48 | /// <param name="sourceLineNumbers"></param> | ||
| 49 | /// <param name="elementName"></param> | ||
| 50 | /// <param name="attributeName"></param> | ||
| 51 | /// <param name="variableName"></param> | ||
| 52 | /// <param name="nameRule"></param> | ||
| 53 | /// <returns>Whether the name is valid.</returns> | ||
| 54 | bool ValidateBundleVariableNameValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, BundleVariableNameRule nameRule); | ||
| 55 | |||
| 56 | /// <summary> | ||
| 57 | /// Validates a Bundle variable name that is being used to set its value and displays an error for an illegal value. | ||
| 58 | /// </summary> | ||
| 59 | /// <param name="sourceLineNumbers"></param> | ||
| 60 | /// <param name="elementName"></param> | ||
| 61 | /// <param name="attributeName"></param> | ||
| 62 | /// <param name="variableName"></param> | ||
| 63 | /// <returns>Whether the name is valid.</returns> | ||
| 64 | bool ValidateBundleVariableNameTarget(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName); | ||
| 45 | 65 | ||
| 46 | /// <summary> | 66 | /// <summary> |
| 47 | /// Validates a bundle condition and displays an error for an illegal value. | 67 | /// 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 a8246b9b..3a3c2ceb 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs | |||
| @@ -246,8 +246,9 @@ namespace WixToolset.Extensibility.Services | |||
| 246 | /// </summary> | 246 | /// </summary> |
| 247 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | 247 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> |
| 248 | /// <param name="attribute">The attribute containing the value to get.</param> | 248 | /// <param name="attribute">The attribute containing the value to get.</param> |
| 249 | /// <param name="nameRule">A rule for the contents of the value. If the contents do not follow the rule, an error is thrown.</param> | ||
| 249 | /// <returns>The attribute's value.</returns> | 250 | /// <returns>The attribute's value.</returns> |
| 250 | string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); | 251 | string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, BundleVariableNameRule nameRule = BundleVariableNameRule.CanBeWellKnown | BundleVariableNameRule.CanHaveReservedPrefix); |
| 251 | 252 | ||
| 252 | /// <summary> | 253 | /// <summary> |
| 253 | /// Get a guid attribute value and displays an error for an illegal guid value. | 254 | /// Get a guid attribute value and displays an error for an illegal guid value. |
diff --git a/src/burn/test/BurnUnitTest/VariableTest.cpp b/src/burn/test/BurnUnitTest/VariableTest.cpp index f864307c..8ee6e179 100644 --- a/src/burn/test/BurnUnitTest/VariableTest.cpp +++ b/src/burn/test/BurnUnitTest/VariableTest.cpp | |||
| @@ -163,6 +163,39 @@ namespace Bootstrapper | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | [Fact] | 165 | [Fact] |
| 166 | void VariablesSetCustomWixVariableTest() | ||
| 167 | { | ||
| 168 | HRESULT hr = S_OK; | ||
| 169 | IXMLDOMElement* pixeBundle = NULL; | ||
| 170 | BURN_VARIABLES variables = { }; | ||
| 171 | |||
| 172 | try | ||
| 173 | { | ||
| 174 | LPCWSTR wzDocument = | ||
| 175 | L"<Bundle>" | ||
| 176 | L" <CommandLine Variables='upperCase' />" | ||
| 177 | L"</Bundle>"; | ||
| 178 | |||
| 179 | hr = VariableInitialize(&variables); | ||
| 180 | TestThrowOnFailure(hr, L"Failed to initialize variables."); | ||
| 181 | |||
| 182 | // load XML document | ||
| 183 | LoadBundleXmlHelper(wzDocument, &pixeBundle); | ||
| 184 | |||
| 185 | hr = VariablesParseFromXml(&variables, pixeBundle); | ||
| 186 | NativeAssert::Succeeded(hr, "Failed to parse variables from XML."); | ||
| 187 | |||
| 188 | hr = VariableSetString(&variables, L"WixCustomVariable", L"something", FALSE, FALSE); | ||
| 189 | NativeAssert::Succeeded(hr, "Failed to set 'WixCustomVariable' variable."); | ||
| 190 | } | ||
| 191 | finally | ||
| 192 | { | ||
| 193 | ReleaseObject(pixeBundle); | ||
| 194 | VariablesUninitialize(&variables); | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | [Fact] | ||
| 166 | void VariablesFormatTest() | 199 | void VariablesFormatTest() |
| 167 | { | 200 | { |
| 168 | HRESULT hr = S_OK; | 201 | HRESULT hr = S_OK; |
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs new file mode 100644 index 00000000..68f46af8 --- /dev/null +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs | |||
| @@ -0,0 +1,19 @@ | |||
| 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> | ||
diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 39b792b7..24641fce 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
| @@ -297,6 +297,53 @@ namespace WixToolsetTest.Util | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | [Fact] | 299 | [Fact] |
| 300 | public void CanBuildBundleWithWarningsWithSearchesUsingDiscouragedVariableNames() | ||
| 301 | { | ||
| 302 | var folder = TestData.Get("TestData", "BundleWithSearches"); | ||
| 303 | var rootFolder = TestData.Get(); | ||
| 304 | var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll"); | ||
| 305 | |||
| 306 | using (var fs = new DisposableFileSystem()) | ||
| 307 | { | ||
| 308 | var baseFolder = fs.GetFolder(); | ||
| 309 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 310 | var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
| 311 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 312 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 313 | |||
| 314 | var result = WixRunner.Execute(false, new[] | ||
| 315 | { | ||
| 316 | "build", | ||
| 317 | Path.Combine(folder, "BundleUsingDiscouragedVariableNames.wxs"), | ||
| 318 | "-ext", wixext, | ||
| 319 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | ||
| 320 | "-bindpath", Path.Combine(folder, "data"), | ||
| 321 | "-intermediateFolder", intermediateFolder, | ||
| 322 | "-o", bundlePath, | ||
| 323 | }); | ||
| 324 | |||
| 325 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | ||
| 326 | messages.Sort(); | ||
| 327 | |||
| 328 | WixAssert.CompareLineByLine(new[] | ||
| 329 | { | ||
| 330 | "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.", | ||
| 331 | }, messages.ToArray()); | ||
| 332 | |||
| 333 | result.AssertSuccess(); | ||
| 334 | |||
| 335 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); | ||
| 336 | extractResult.AssertSuccess(); | ||
| 337 | |||
| 338 | 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]"); | ||
| 339 | WixAssert.CompareLineByLine(new[] | ||
| 340 | { | ||
| 341 | @"<RegistrySearch Id='wrsvJmsaXS39nKFUh9CVvRE6SSC4qk' Variable='WixCustomVariable' Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Custom' Value='Release' Win64='yes' Type='value' VariableType='string' />", | ||
| 342 | }, utilSearches); | ||
| 343 | } | ||
| 344 | } | ||
| 345 | |||
| 346 | [Fact] | ||
| 300 | public void CannotBuildBundleWithSearchesUsingBuiltinVariableNames() | 347 | public void CannotBuildBundleWithSearchesUsingBuiltinVariableNames() |
| 301 | { | 348 | { |
| 302 | var folder = TestData.Get("TestData", "BundleWithSearches"); | 349 | var folder = TestData.Get("TestData", "BundleWithSearches"); |
| @@ -307,7 +354,6 @@ namespace WixToolsetTest.Util | |||
| 307 | { | 354 | { |
| 308 | var baseFolder = fs.GetFolder(); | 355 | var baseFolder = fs.GetFolder(); |
| 309 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 356 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 310 | var bundlePath = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 311 | 357 | ||
| 312 | var result = WixRunner.Execute(new[] | 358 | var result = WixRunner.Execute(new[] |
| 313 | { | 359 | { |
| @@ -317,7 +363,7 @@ namespace WixToolsetTest.Util | |||
| 317 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), | 363 | "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), |
| 318 | "-bindpath", Path.Combine(folder, "data"), | 364 | "-bindpath", Path.Combine(folder, "data"), |
| 319 | "-intermediateFolder", intermediateFolder, | 365 | "-intermediateFolder", intermediateFolder, |
| 320 | "-o", bundlePath | 366 | "-o", "bundle.wixlib", |
| 321 | }); | 367 | }); |
| 322 | 368 | ||
| 323 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | 369 | var messages = result.Messages.Select(m => m.ToString()).ToList(); |
| @@ -325,13 +371,12 @@ namespace WixToolsetTest.Util | |||
| 325 | 371 | ||
| 326 | WixAssert.CompareLineByLine(new[] | 372 | WixAssert.CompareLineByLine(new[] |
| 327 | { | 373 | { |
| 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'.", | 374 | "The DirectorySearch/@Variable attribute's value, 'InstallerName', 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'.", |
| 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'.", | 375 | "The FileSearch/@Variable attribute's value, 'NativeMachine', 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'.", |
| 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'.", | 376 | "The ProductSearch/@Variable attribute's value, 'Date', 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'.", |
| 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.", | 377 | "The RegistrySearch/@Variable attribute's value, 'VersionNT64', 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'.", |
| 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'.", | 378 | "The RegistrySearch/@Variable attribute's value, 'WixBundleAction', 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'.", |
| 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'.", | 379 | "The WindowsFeatureSearch/@Variable attribute's value, 'NTProductType', 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'.", |
| 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'.", | ||
| 335 | }, messages.ToArray()); | 380 | }, messages.ToArray()); |
| 336 | } | 381 | } |
| 337 | } | 382 | } |
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs index a37e874c..49a25c0a 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, allowBuiltIn: false); | 166 | this.BackendHelper.ValidateBundleVariableNameTarget(symbol.SourceLineNumbers, "*Search", "Variable", symbol.Variable); |
| 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, allowBuiltIn: false); | 176 | this.BackendHelper.ValidateBundleVariableNameDeclaration(symbol.SourceLineNumbers, "Variable", "Name", symbol.Id.Id); |
| 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 58fdeca5..93e7fc20 100644 --- a/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs +++ b/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs | |||
| @@ -190,9 +190,19 @@ 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, bool allowBuiltIn) | 193 | public bool ValidateBundleVariableNameDeclaration(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) |
| 194 | { | 194 | { |
| 195 | return this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName, allowBuiltIn); | 195 | return this.bundleValidator.ValidateBundleVariableNameDeclaration(sourceLineNumbers, elementName, attributeName, variableName); |
| 196 | } | ||
| 197 | |||
| 198 | public bool ValidateBundleVariableNameValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, BundleVariableNameRule nameRule) | ||
| 199 | { | ||
| 200 | return this.bundleValidator.ValidateBundleVariableNameValue(sourceLineNumbers, elementName, attributeName, variableName, nameRule); | ||
| 201 | } | ||
| 202 | |||
| 203 | public bool ValidateBundleVariableNameTarget(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) | ||
| 204 | { | ||
| 205 | return this.bundleValidator.ValidateBundleVariableNameTarget(sourceLineNumbers, elementName, attributeName, variableName); | ||
| 196 | } | 206 | } |
| 197 | 207 | ||
| 198 | public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase) | 208 | public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase) |
diff --git a/src/wix/WixToolset.Core/CompilerWarnings.cs b/src/wix/WixToolset.Core/CompilerWarnings.cs index 7fca29bb..ed221c3e 100644 --- a/src/wix/WixToolset.Core/CompilerWarnings.cs +++ b/src/wix/WixToolset.Core/CompilerWarnings.cs | |||
| @@ -36,11 +36,21 @@ namespace WixToolset.Core | |||
| 36 | return Message(sourceLineNumbers, Ids.ProvidesKeyNotFound, "The provider key with identifier {0} was not found in the Wix4DependencyProvider table. Related registry rows will not be removed from authoring.", id); | 36 | return Message(sourceLineNumbers, Ids.ProvidesKeyNotFound, "The provider key with identifier {0} was not found in the Wix4DependencyProvider table. Related registry rows will not be removed from authoring.", id); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | public static Message ReadonlyLogVariableTarget(SourceLineNumber sourceLineNumbers, string element, string attribute, string name) | ||
| 40 | { | ||
| 41 | return Message(sourceLineNumbers, Ids.ReadonlyLogVariableTarget, "The {0}/@{1} attribute's value references the well-known log Variable '{2}' 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.", element, attribute, name); | ||
| 42 | } | ||
| 43 | |||
| 39 | public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id) | 44 | public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id) |
| 40 | { | 45 | { |
| 41 | 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); | 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); |
| 42 | } | 47 | } |
| 43 | 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 | |||
| 44 | public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) | 54 | public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) |
| 45 | { | 55 | { |
| 46 | 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); | 56 | 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); |
| @@ -60,6 +70,8 @@ namespace WixToolset.Core | |||
| 60 | Win64Component = 5435, | 70 | Win64Component = 5435, |
| 61 | DirectoryRefStandardDirectoryDeprecated = 5436, | 71 | DirectoryRefStandardDirectoryDeprecated = 5436, |
| 62 | DefiningStandardDirectoryDeprecated = 5437, | 72 | DefiningStandardDirectoryDeprecated = 5437, |
| 73 | ReadonlyLogVariableTarget = 5438, | ||
| 74 | ReservedBurnNamespaceWarning = 5439, | ||
| 63 | } // 5400-5499 and 6600-6699 were the ranges for Dependency and Tag which are now in Core between CompilerWarnings and CompilerErrors. | 75 | } // 5400-5499 and 6600-6699 were the ranges for Dependency and Tag which are now in Core between CompilerWarnings and CompilerErrors. |
| 64 | } | 76 | } |
| 65 | } | 77 | } |
diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs index 8717a3b9..838ffb88 100644 --- a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs +++ b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs | |||
| @@ -109,6 +109,21 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 109 | "WixBundleVersion", | 109 | "WixBundleVersion", |
| 110 | }); | 110 | }); |
| 111 | 111 | ||
| 112 | // Well-known variables (from burn\engine\variable.cpp, "vrgWellKnownVariables", around line 304) | ||
| 113 | private static readonly List<string> WellKnownBundleVariables = new List<string>( | ||
| 114 | new string[] { | ||
| 115 | "WixBundleInProgressName", | ||
| 116 | "WixBundleLastUsedSource", | ||
| 117 | "WixBundleLayoutDirectory", | ||
| 118 | "WixBundleLog", | ||
| 119 | "WixBundleLog_*", | ||
| 120 | "WixBundleRollbackLog_*", | ||
| 121 | "WixBundleManufacturer", | ||
| 122 | "WixBundleName", | ||
| 123 | "WixBundleOriginalSource", | ||
| 124 | "WixBundleOriginalSourceFolder", | ||
| 125 | }); | ||
| 126 | |||
| 112 | private static readonly List<string> DisallowedMsiProperties = new List<string>( | 127 | private static readonly List<string> DisallowedMsiProperties = new List<string>( |
| 113 | new string[] { | 128 | new string[] { |
| 114 | "ACTION", | 129 | "ACTION", |
| @@ -156,7 +171,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 156 | return relativePath; | 171 | return relativePath; |
| 157 | } | 172 | } |
| 158 | 173 | ||
| 159 | public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, bool allowBuiltIn) | 174 | public bool ValidateBundleVariableNameDeclaration(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) |
| 160 | { | 175 | { |
| 161 | if (String.IsNullOrEmpty(variableName)) | 176 | if (String.IsNullOrEmpty(variableName)) |
| 162 | { | 177 | { |
| @@ -170,14 +185,14 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 170 | 185 | ||
| 171 | return false; | 186 | return false; |
| 172 | } | 187 | } |
| 173 | else if (!allowBuiltIn && BuiltinBundleVariables.Contains(variableName)) | 188 | else if (BuiltinBundleVariables.Contains(variableName)) |
| 174 | { | 189 | { |
| 175 | var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables); | 190 | var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables); |
| 176 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); | 191 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); |
| 177 | 192 | ||
| 178 | return false; | 193 | return false; |
| 179 | } | 194 | } |
| 180 | else if (!allowBuiltIn && variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) | 195 | else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) |
| 181 | { | 196 | { |
| 182 | this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix")); | 197 | this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix")); |
| 183 | 198 | ||
| @@ -189,6 +204,105 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 189 | } | 204 | } |
| 190 | } | 205 | } |
| 191 | 206 | ||
| 207 | public bool ValidateBundleVariableNameValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName, BundleVariableNameRule nameRule) | ||
| 208 | { | ||
| 209 | if (String.IsNullOrEmpty(variableName)) | ||
| 210 | { | ||
| 211 | this.Messaging.Write(ErrorMessages.IllegalEmptyAttributeValue(sourceLineNumbers, elementName, attributeName)); | ||
| 212 | |||
| 213 | return false; | ||
| 214 | } | ||
| 215 | else if (!Common.IsBundleVariableName(variableName)) | ||
| 216 | { | ||
| 217 | this.Messaging.Write(CompilerErrors.IllegalBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName)); | ||
| 218 | |||
| 219 | return false; | ||
| 220 | } | ||
| 221 | else if (BuiltinBundleVariables.Contains(variableName)) | ||
| 222 | { | ||
| 223 | var allowed = nameRule.HasFlag(BundleVariableNameRule.CanBeBuiltIn); | ||
| 224 | if (!allowed) | ||
| 225 | { | ||
| 226 | var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables); | ||
| 227 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); | ||
| 228 | } | ||
| 229 | |||
| 230 | return allowed; | ||
| 231 | } | ||
| 232 | else if (WellKnownBundleVariables.Contains(variableName) || | ||
| 233 | variableName.StartsWith("WixBundleLog_", StringComparison.OrdinalIgnoreCase) || | ||
| 234 | variableName.StartsWith("WixBundleRollbackLog_", StringComparison.OrdinalIgnoreCase)) | ||
| 235 | { | ||
| 236 | var allowed = nameRule.HasFlag(BundleVariableNameRule.CanBeWellKnown); | ||
| 237 | if (!allowed) | ||
| 238 | { | ||
| 239 | var illegalValues = CreateValueList(ValueListKind.Or, WellKnownBundleVariables); | ||
| 240 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); | ||
| 241 | } | ||
| 242 | |||
| 243 | return allowed; | ||
| 244 | } | ||
| 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 | } | ||
| 255 | else | ||
| 256 | { | ||
| 257 | return true; | ||
| 258 | } | ||
| 259 | } | ||
| 260 | |||
| 261 | public bool ValidateBundleVariableNameTarget(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) | ||
| 262 | { | ||
| 263 | if (String.IsNullOrEmpty(variableName)) | ||
| 264 | { | ||
| 265 | this.Messaging.Write(ErrorMessages.IllegalEmptyAttributeValue(sourceLineNumbers, elementName, attributeName)); | ||
| 266 | |||
| 267 | return false; | ||
| 268 | } | ||
| 269 | else if (!Common.IsBundleVariableName(variableName)) | ||
| 270 | { | ||
| 271 | this.Messaging.Write(CompilerErrors.IllegalBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName)); | ||
| 272 | |||
| 273 | return false; | ||
| 274 | } | ||
| 275 | else if (BuiltinBundleVariables.Contains(variableName)) | ||
| 276 | { | ||
| 277 | var illegalValues = CreateValueList(ValueListKind.Or, BuiltinBundleVariables); | ||
| 278 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithIllegalList(sourceLineNumbers, elementName, attributeName, variableName, illegalValues)); | ||
| 279 | |||
| 280 | return false; | ||
| 281 | } | ||
| 282 | else if (variableName.Equals("WixBundleLog", StringComparison.OrdinalIgnoreCase) || | ||
| 283 | variableName.StartsWith("WixBundleLog_", StringComparison.OrdinalIgnoreCase) || | ||
| 284 | variableName.StartsWith("WixBundleRollbackLog_", StringComparison.OrdinalIgnoreCase)) | ||
| 285 | { | ||
| 286 | this.Messaging.Write(CompilerWarnings.ReadonlyLogVariableTarget(sourceLineNumbers, elementName, attributeName, variableName)); | ||
| 287 | |||
| 288 | return true; | ||
| 289 | } | ||
| 290 | else if (WellKnownBundleVariables.Contains(variableName)) | ||
| 291 | { | ||
| 292 | return true; | ||
| 293 | } | ||
| 294 | else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) | ||
| 295 | { | ||
| 296 | this.Messaging.Write(CompilerWarnings.ReservedBurnNamespaceWarning(sourceLineNumbers, elementName, attributeName, "Wix")); | ||
| 297 | |||
| 298 | return true; | ||
| 299 | } | ||
| 300 | else | ||
| 301 | { | ||
| 302 | return true; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | |||
| 192 | public bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName) | 306 | public bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName) |
| 193 | { | 307 | { |
| 194 | if (String.IsNullOrEmpty(propertyName)) | 308 | if (String.IsNullOrEmpty(propertyName)) |
diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index 31607b02..5f4ac726 100644 --- a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs | |||
| @@ -246,9 +246,9 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 246 | { | 246 | { |
| 247 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, elementName, "Variable")); | 247 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, elementName, "Variable")); |
| 248 | } | 248 | } |
| 249 | else | 249 | else if (!this.IsValidLocIdentifier(variable) && !Common.IsValidBinderVariable(variable)) |
| 250 | { | 250 | { |
| 251 | this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, "Variable", variable, allowBuiltIn: false); | 251 | this.BundleValidator.ValidateBundleVariableNameValue(sourceLineNumbers, elementName, "Variable", variable, BundleVariableNameRule.CanBeWellKnown | BundleVariableNameRule.CanHaveReservedPrefix); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | section.AddSymbol(new WixSearchSymbol(sourceLineNumbers, id) | 254 | section.AddSymbol(new WixSearchSymbol(sourceLineNumbers, id) |
| @@ -322,19 +322,19 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 322 | 322 | ||
| 323 | if (!String.IsNullOrEmpty(variableId?.Id)) | 323 | if (!String.IsNullOrEmpty(variableId?.Id)) |
| 324 | { | 324 | { |
| 325 | this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableId.Id, allowBuiltIn: false); | 325 | this.BundleValidator.ValidateBundleVariableNameDeclaration(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableId.Id); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | return variableId; | 328 | return variableId; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | public string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute) | 331 | public string GetAttributeBundleVariableNameValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, BundleVariableNameRule nameRule = BundleVariableNameRule.CanBeWellKnown | BundleVariableNameRule.CanHaveReservedPrefix) |
| 332 | { | 332 | { |
| 333 | var variableName = this.GetAttributeValue(sourceLineNumbers, attribute); | 333 | var variableName = this.GetAttributeValue(sourceLineNumbers, attribute); |
| 334 | 334 | ||
| 335 | if (!String.IsNullOrEmpty(variableName)) | 335 | if (!String.IsNullOrEmpty(variableName) && !this.IsValidLocIdentifier(variableName) && !Common.IsValidBinderVariable(variableName)) |
| 336 | { | 336 | { |
| 337 | this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableName, allowBuiltIn: false); | 337 | this.BundleValidator.ValidateBundleVariableNameValue(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, variableName, nameRule); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | return variableName; | 340 | return variableName; |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index b09506c0..9c636a8f 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs | |||
| @@ -7,6 +7,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 7 | using System.Linq; | 7 | using System.Linq; |
| 8 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
| 9 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
| 10 | using WixToolset.Data; | ||
| 10 | using Xunit; | 11 | using Xunit; |
| 11 | 12 | ||
| 12 | public class BadInputFixture | 13 | public class BadInputFixture |
| @@ -179,12 +180,11 @@ namespace WixToolsetTest.CoreIntegration | |||
| 179 | 180 | ||
| 180 | WixAssert.CompareLineByLine(new[] | 181 | WixAssert.CompareLineByLine(new[] |
| 181 | { | 182 | { |
| 182 | "The SetVariable/@Variable attribute's value, '!(loc.BuiltinBurnVariableName)', is not a legal bundle variable name. Identifiers may contain ASCII characters A-Z, a-z, digits, or underscores (_). Every identifier must begin with either a letter or an underscore.", | ||
| 183 | "The Variable/@Name attribute was not found; it is required.", | 183 | "The Variable/@Name attribute was not found; it is required.", |
| 184 | "The Variable/@Name attribute's value, '!(loc.BuiltinBurnVariableName)', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.", | 184 | "The Variable/@Name attribute's value, '!(loc.BuiltinBurnVariableName)', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.", |
| 185 | }, messages.ToArray()); | 185 | }, messages.ToArray()); |
| 186 | 186 | ||
| 187 | Assert.Equal(6603, result.ExitCode); | 187 | Assert.Equal(10, result.ExitCode); |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | 190 | ||
| @@ -212,7 +212,6 @@ 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.", | ||
| 216 | "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'.", | 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'.", |
| 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.", | 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.", |
| 218 | "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 | "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'.", |
| @@ -232,7 +231,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 232 | var baseFolder = fs.GetFolder(); | 231 | var baseFolder = fs.GetFolder(); |
| 233 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 232 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 234 | 233 | ||
| 235 | var result = WixRunner.Execute(new[] | 234 | var result = WixRunner.Execute(false, new[] |
| 236 | { | 235 | { |
| 237 | "build", | 236 | "build", |
| 238 | Path.Combine(folder, "BundleWithInvalid", "BundleWithInvalidLocValues.wxs"), | 237 | Path.Combine(folder, "BundleWithInvalid", "BundleWithInvalidLocValues.wxs"), |
| @@ -244,21 +243,30 @@ namespace WixToolsetTest.CoreIntegration | |||
| 244 | "-o", Path.Combine(baseFolder, @"bin\test.exe") | 243 | "-o", Path.Combine(baseFolder, @"bin\test.exe") |
| 245 | }); | 244 | }); |
| 246 | 245 | ||
| 247 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | 246 | var warningMessages = result.Messages.Where(m => m.Level == MessageLevel.Warning).Select(m => m.ToString()).ToList(); |
| 248 | messages.Sort(); | 247 | warningMessages.Sort(); |
| 249 | 248 | ||
| 250 | WixAssert.CompareLineByLine(new[] | 249 | WixAssert.CompareLineByLine(new[] |
| 251 | { | 250 | { |
| 252 | "*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.", | 251 | "*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.", |
| 253 | "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.", | 252 | "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.", |
| 254 | "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.", | 253 | "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.", |
| 254 | "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.", | ||
| 255 | "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.", | ||
| 256 | }, warningMessages.ToArray()); | ||
| 257 | |||
| 258 | var errorMessages = result.Messages.Where(m => m.Level == MessageLevel.Error).Select(m => m.ToString()).ToList(); | ||
| 259 | errorMessages.Sort(); | ||
| 260 | |||
| 261 | WixAssert.CompareLineByLine(new[] | ||
| 262 | { | ||
| 255 | "The CommandLine/@Condition attribute's value '=' is not a valid bundle condition.", | 263 | "The CommandLine/@Condition attribute's value '=' is not a valid bundle condition.", |
| 256 | "The MsiPackage/@InstallCondition attribute's value '=' is not a valid bundle condition.", | 264 | "The MsiPackage/@InstallCondition attribute's value '=' is not a valid bundle condition.", |
| 257 | "The MsiProperty/@Condition attribute's value '=' is not a valid bundle condition.", | 265 | "The MsiProperty/@Condition attribute's value '=' is not a valid bundle condition.", |
| 258 | "The 'REINSTALLMODE' MsiProperty is controlled by the bootstrapper and cannot be authored. (Illegal properties are: 'ACTION', 'ADDLOCAL', 'ADDSOURCE', 'ADDDEFAULT', 'ADVERTISE', 'ALLUSERS', 'REBOOT', 'REINSTALL', 'REINSTALLMODE', or 'REMOVE'.) Remove the MsiProperty element.", | 266 | "The 'REINSTALLMODE' MsiProperty is controlled by the bootstrapper and cannot be authored. (Illegal properties are: 'ACTION', 'ADDLOCAL', 'ADDSOURCE', 'ADDDEFAULT', 'ADVERTISE', 'ALLUSERS', 'REBOOT', 'REINSTALL', 'REINSTALLMODE', or 'REMOVE'.) Remove the MsiProperty element.", |
| 259 | }, messages.ToArray()); | 267 | }, errorMessages.ToArray()); |
| 260 | 268 | ||
| 261 | Assert.Equal(1159, result.ExitCode); | 269 | Assert.Equal(409, result.ExitCode); |
| 262 | } | 270 | } |
| 263 | } | 271 | } |
| 264 | } | 272 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxl b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxl index 0b5fac56..da2de367 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxl +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxl | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | 1 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> |
| 2 | <String Id="BuiltinMsiPropertyName">REINSTALLMODE</String> | 2 | <String Id="BuiltinMsiPropertyName">REINSTALLMODE</String> |
| 3 | <String Id="BuiltinBurnVariableName">WixBundleInstalled</String> | 3 | <String Id="BuiltinBurnVariableName">WixBundleInstalled</String> |
| 4 | <String Id="BurnLogVariableName">WixBundleLog</String> | ||
| 5 | <String Id="BurnReservedPrefixVariableName">WixCustomVariable</String> | ||
| 4 | <String Id="NonsenseDetectCondition">WixBundleAction = 4</String> | 6 | <String Id="NonsenseDetectCondition">WixBundleAction = 4</String> |
| 5 | <String Id="NonsenseExecuteCondition">=</String> | 7 | <String Id="NonsenseExecuteCondition">=</String> |
| 6 | <String Id="NonsenseGlobalCondition">WixBundleInstalled <> 1</String> | 8 | <String Id="NonsenseGlobalCondition">WixBundleInstalled <> 1</String> |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxs index 74f66bbb..6e1a4dd7 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithInvalidLocValues.wxs | |||
| @@ -13,5 +13,7 @@ | |||
| 13 | </ExePackage> | 13 | </ExePackage> |
| 14 | </Chain> | 14 | </Chain> |
| 15 | <SetVariable Id="Builtin" Condition="!(loc.NonsenseDetectCondition)" Variable="FOO" Value="1" /> | 15 | <SetVariable Id="Builtin" Condition="!(loc.NonsenseDetectCondition)" Variable="FOO" Value="1" /> |
| 16 | <SetVariable Id="LogWellKnown" Variable="!(loc.BurnLogVariableName)" Value="2" /> | ||
| 17 | <SetVariable Id="ReservedPrefix" Variable="!(loc.BurnReservedPrefixVariableName)" Value="3" /> | ||
| 16 | </Bundle> | 18 | </Bundle> |
| 17 | </Wix> | 19 | </Wix> |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs index 3a38e2c9..af0e6625 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithReservedVariableNames.wxs | |||
| @@ -1,7 +1,6 @@ | |||
| 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" /> | ||
| 5 | <Variable Name="WixCustomVariable" /> | 4 | <Variable Name="WixCustomVariable" /> |
| 6 | <Variable Name="AppDataFolder" /> | 5 | <Variable Name="AppDataFolder" /> |
| 7 | </Fragment> | 6 | </Fragment> |
