From 44a13ff738267fc7e1147e46cd86df6cdbba7bb3 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 1 Jan 2024 22:07:46 -0500 Subject: Remove warning for `Wix` bundle variable prefix. It's a bit overzealous. Fixes https://github.com/wixtoolset/issues/issues/7579. --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 2 +- .../WixToolsetTest.Netfx/NetfxExtensionFixture.cs | 35 ++++++++++++++++ .../TestData/UsingNetFxSearches/BundleLatest.wxs | 13 ++++++ .../BundleUsingDiscouragedVariableNames.wxs | 19 --------- .../WixToolsetTest.Util/UtilExtensionFixture.cs | 47 ---------------------- src/wix/WixToolset.Core/CompilerWarnings.cs | 7 +--- .../ExtensibilityServices/BundleValidator.cs | 22 ---------- .../BadInputFixture.cs | 2 - 8 files changed, 50 insertions(+), 97 deletions(-) create mode 100644 src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxSearches/BundleLatest.wxs delete mode 100644 src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index e149d54a..e7c88613 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -1773,7 +1773,7 @@ namespace WixToolset.Data public static Message ReservedNamespaceViolation(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix) { - 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); + 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); } public static Message RootFeatureCannotFollowParent(SourceLineNumber sourceLineNumbers) diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs index bb3b7b35..27a19116 100644 --- a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs @@ -108,6 +108,41 @@ namespace WixToolsetTest.Netfx } } + [Fact] + public void CanBuildUsingNetFxSearches() + { + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); + var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxSearches"); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var extensionResult = WixRunner.Execute(warningsAsErrors: true, new[] + { + "extension", "add", + "WixToolset.Bal.wixext", + "extension", "add", + "WixToolset.Util.wixext", + }); + + var compileResult = WixRunner.Execute(new[] + { + "build", + Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), + "-ext", "WixToolset.Bal.wixext", + "-ext", "WixToolset.Util.wixext", + "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), + "-intermediateFolder", intermediateFolder, + "-o", bundleFile, + "-arch", "x64", + }); + compileResult.AssertSuccess(); + + Assert.True(File.Exists(bundleFile)); + } + } + [Fact] public void CanBuildUsingNativeImage() { diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxSearches/BundleLatest.wxs b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxSearches/BundleLatest.wxs new file mode 100644 index 00000000..1ee62d4b --- /dev/null +++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxSearches/BundleLatest.wxs @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs deleted file mode 100644 index 68f46af8..00000000 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/BundleUsingDiscouragedVariableNames.wxs +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 7cc3a6d4..06e70dcf 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs @@ -470,53 +470,6 @@ namespace WixToolsetTest.Util }, results.OrderBy(s => s).ToArray()); } - [Fact] - public void CanBuildBundleWithWarningsWithSearchesUsingDiscouragedVariableNames() - { - var folder = TestData.Get("TestData", "BundleWithSearches"); - var rootFolder = TestData.Get(); - var wixext = Path.Combine(rootFolder, "WixToolset.Util.wixext.dll"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var intermediateFolder = Path.Combine(baseFolder, "obj"); - var bundlePath = Path.Combine(baseFolder, @"bin\test.exe"); - var baFolderPath = Path.Combine(baseFolder, "ba"); - var extractFolderPath = Path.Combine(baseFolder, "extract"); - - var result = WixRunner.Execute(false, new[] - { - "build", - Path.Combine(folder, "BundleUsingDiscouragedVariableNames.wxs"), - "-ext", wixext, - "-loc", Path.Combine(folder, "Bundle.en-us.wxl"), - "-bindpath", Path.Combine(folder, "data"), - "-intermediateFolder", intermediateFolder, - "-o", bundlePath, - }); - - var messages = result.Messages.Select(m => m.ToString()).ToList(); - messages.Sort(); - - WixAssert.CompareLineByLine(new[] - { - "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.", - }, messages.ToArray()); - - result.AssertSuccess(); - - var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); - extractResult.AssertSuccess(); - - 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]"); - WixAssert.CompareLineByLine(new[] - { - @"", - }, utilSearches); - } - } - [Fact] public void CannotBuildBundleWithSearchesUsingBuiltinVariableNames() { diff --git a/src/wix/WixToolset.Core/CompilerWarnings.cs b/src/wix/WixToolset.Core/CompilerWarnings.cs index ed221c3e..f4ac6afe 100644 --- a/src/wix/WixToolset.Core/CompilerWarnings.cs +++ b/src/wix/WixToolset.Core/CompilerWarnings.cs @@ -46,11 +46,6 @@ namespace WixToolset.Core 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); } - public static Message ReservedBurnNamespaceWarning(SourceLineNumber sourceLineNumbers, string element, string attribute, string prefix) - { - 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); - } - public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) { return Message(sourceLineNumbers, Ids.Win64Component, "The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Bitness attribute to \"always32\" to ensure the dependency feature works correctly on legacy operating systems.", componentId); @@ -71,7 +66,7 @@ namespace WixToolset.Core DirectoryRefStandardDirectoryDeprecated = 5436, DefiningStandardDirectoryDeprecated = 5437, ReadonlyLogVariableTarget = 5438, - ReservedBurnNamespaceWarning = 5439, + // DO_NOT_REUSE ReservedBurnNamespaceWarning = 5439, } // 5400-5499 and 6600-6699 were the ranges for Dependency and Tag which are now in Core between CompilerWarnings and CompilerErrors. } } diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs index 838ffb88..6533d159 100644 --- a/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs +++ b/src/wix/WixToolset.Core/ExtensibilityServices/BundleValidator.cs @@ -192,12 +192,6 @@ namespace WixToolset.Core.ExtensibilityServices return false; } - else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) - { - this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix")); - - return false; - } else { return true; @@ -242,16 +236,6 @@ namespace WixToolset.Core.ExtensibilityServices return allowed; } - else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) - { - var allowed = nameRule.HasFlag(BundleVariableNameRule.CanHaveReservedPrefix); - if (!allowed) - { - this.Messaging.Write(ErrorMessages.ReservedBurnNamespaceViolation(sourceLineNumbers, elementName, attributeName, "Wix")); - } - - return allowed; - } else { return true; @@ -291,12 +275,6 @@ namespace WixToolset.Core.ExtensibilityServices { return true; } - else if (variableName.StartsWith("Wix", StringComparison.OrdinalIgnoreCase)) - { - this.Messaging.Write(CompilerWarnings.ReservedBurnNamespaceWarning(sourceLineNumbers, elementName, attributeName, "Wix")); - - return true; - } else { return true; diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index ce28faff..f19f069d 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs @@ -213,7 +213,6 @@ namespace WixToolsetTest.CoreIntegration WixAssert.CompareLineByLine(new[] { "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'.", - "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.", "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'.", }, messages.ToArray()); @@ -283,7 +282,6 @@ namespace WixToolsetTest.CoreIntegration "*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.", "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.", "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.", - "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.", "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.", }, warningMessages); -- cgit v1.2.3-55-g6feb