From 866413ec39c573a50b7ec0753f643918a1939dee Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 13 Apr 2022 10:12:50 -0500 Subject: Only allow MsiPackage and MspPackage inside MSI transactions. Improve 64-bit package detection. --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 24 +++++++++++++++++++++--- src/api/wix/WixToolset.Data/WarningMessages.cs | 6 ++++++ 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index a833452d..186acd29 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -1494,9 +1494,24 @@ namespace WixToolset.Data return Message(null, Ids.MissingValidatorExtension, "The validator requires at least one extension. Add \"ValidatorExtension, Wix\" for the default implementation."); } - public static Message MsiTransactionX86BeforeX64(SourceLineNumber sourceLineNumbers) + public static Message MsiTransactionInvalidPackage(SourceLineNumber sourceLineNumbers, string packageId, string packageType) { - return Message(sourceLineNumbers, Ids.MsiTransactionX86BeforeX64, "MSI transactions must install all x64 packages before any x86 package."); + return Message(sourceLineNumbers, Ids.MsiTransactionInvalidPackage, "Invalid package '{0}' in MSI transaction. It is type '{1}' but must be Msi or Msp.", packageId, packageType); + } + + public static Message MsiTransactionInvalidPackage2(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.MsiTransactionInvalidPackage2, "Location of rollback boundary related to previous error."); + } + + public static Message MsiTransactionX86BeforeX64Package(SourceLineNumber sourceLineNumbers, string x64PackageId, string x86PackageId) + { + return Message(sourceLineNumbers, Ids.MsiTransactionX86BeforeX64Package, "Package '{0}' is x64 but Package '{1}' is x86. MSI transactions must install all x64 packages before any x86 package.", x64PackageId, x86PackageId); + } + + public static Message MsiTransactionX86BeforeX64Package2(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.MsiTransactionX86BeforeX64Package2, "Location of x86 package related to previous error."); } public static Message MultipleEntrySections(SourceLineNumber sourceLineNumbers, string sectionName1, string sectionName2) @@ -2672,7 +2687,7 @@ namespace WixToolset.Data InlineDirectorySyntaxRequiresPath = 387, InsecureBundleFilename = 388, PayloadMustBeRelativeToCache = 389, - MsiTransactionX86BeforeX64 = 390, + MsiTransactionX86BeforeX64Package = 390, NoSourceFiles = 391, WixiplSourceFileIsExclusive = 392, UnableToConvertFieldToNumber = 393, @@ -2692,6 +2707,9 @@ namespace WixToolset.Data MissingPackagePayload = 407, ExpectedAttributeWithoutOtherAttributes = 408, InvalidBundleCondition = 409, + MsiTransactionX86BeforeX64Package2 = 410, + MsiTransactionInvalidPackage = 411, + MsiTransactionInvalidPackage2 = 412, } } } diff --git a/src/api/wix/WixToolset.Data/WarningMessages.cs b/src/api/wix/WixToolset.Data/WarningMessages.cs index 0c026b68..ecd76392 100644 --- a/src/api/wix/WixToolset.Data/WarningMessages.cs +++ b/src/api/wix/WixToolset.Data/WarningMessages.cs @@ -222,6 +222,11 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.DiscardedRollbackBoundary, "The RollbackBoundary '{0}' was discarded because it was not followed by a package. Without a package the rollback boundary doesn't do anything. Verify that the RollbackBoundary element is not followed by another RollbackBoundary and that the element is not at the end of the chain.", rollbackBoundaryId); } + public static Message DiscardedRollbackBoundary2(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.DiscardedRollbackBoundary2, "Location of rollback boundary related to previous warning."); + } + public static Message DiscouragedAllUsersValue(SourceLineNumber sourceLineNumbers, string path, string machineOrUser) { return Message(sourceLineNumbers, Ids.DiscouragedAllUsersValue, "Bundles require a package to be either per-machine or per-user. The MSI '{0}' ALLUSERS Property is set to '2' which may change from per-user to per-machine at install time. The Bundle will assume the package is per-{1} and will not work correctly if that changes. If possible, remove the Property with Id='ALLUSERS' and use Package/@InstallScope attribute instead.", path, machineOrUser); @@ -821,6 +826,7 @@ namespace WixToolset.Data InvalidEnvironmentVariable = 1157, WindowsInstallerFileTooLarge = 1158, UnavailableBundleConditionVariable = 1159, + DiscardedRollbackBoundary2 = 1160, } } } -- cgit v1.2.3-55-g6feb