From 6f6e4ced9f398ff37a44b91fdba62479cde29d06 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 9 Jun 2022 15:30:48 -0500 Subject: Implement ArpEntry flavored ExePackage. 6772 --- src/api/wix/WixToolset.Data/ErrorMessages.cs | 29 +++++++++--- .../Symbols/WixBundleExePackageSymbol.cs | 51 ++++++++++++++++++++++ src/api/wix/WixToolset.Data/WarningMessages.cs | 20 +++++++-- 3 files changed, 90 insertions(+), 10 deletions(-) (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index d3d2932d..31888d1f 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -388,7 +388,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0}/@{1} attribute was not found; it is required.", elementName, attributeName); } - public static Message ExpectedAttribute(SourceLineNumber sourceLineNumbers, string elementName, string attribute1Name, string attribute2Name, Boolean eitherOr) + public static Message ExpectedAttribute(SourceLineNumber sourceLineNumbers, string elementName, string attribute1Name, string attribute2Name, bool eitherOr) { return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0} element must have a value for exactly one of the {1} or {2} attributes.", elementName, attribute1Name, attribute2Name, eitherOr); } @@ -403,7 +403,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0}/@{1} attribute was not found; it is required when attribute {2} has a value of '{3}'.", elementName, attributeName, otherAttributeName, otherAttributeValue); } - public static Message ExpectedAttribute(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string otherAttributeName, string otherAttributeValue, Boolean otherAttributeValueUnless) + public static Message ExpectedAttribute(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string otherAttributeName, string otherAttributeValue, bool otherAttributeValueUnless) { return Message(sourceLineNumbers, Ids.ExpectedAttribute, "The {0}/@{1} attribute was not found; it is required unless the attribute {2} has a value of '{3}'.", elementName, attributeName, otherAttributeName, otherAttributeValue, otherAttributeValueUnless); } @@ -428,6 +428,21 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.ExpectedAttributeOrElement, "Element '{0}' missing attribute '{1}' or child element '{2}'. Exactly one of those is required.", parentElement, attribute, childElement); } + public static Message ExpectedAttributeOrElementWithOtherAttribute(SourceLineNumber sourceLineNumbers, string parentElement, string attribute, string childElement, string otherAttribute) + { + return Message(sourceLineNumbers, Ids.ExpectedAttributeOrElementWithOtherAttribute, "Element '{0}' missing attribute '{1}' or child element '{2}'. Exactly one of those is required when attribute '{3}' is specified.", parentElement, attribute, childElement, otherAttribute); + } + + public static Message ExpectedAttributeOrElementWithOtherAttribute(SourceLineNumber sourceLineNumbers, string parentElement, string attribute, string childElement, string otherAttribute, string otherAttributeValue) + { + return Message(sourceLineNumbers, Ids.ExpectedAttributeOrElementWithOtherAttribute, "Element '{0}' missing attribute '{1}' or child element '{2}'. Exactly one of those is required when attribute '{3}' is specified with value '{4}'.", parentElement, attribute, childElement, otherAttribute, otherAttributeValue); + } + + public static Message ExpectedAttributeOrElementWithoutOtherAttribute(SourceLineNumber sourceLineNumbers, string parentElement, string attribute, string childElement, string otherAttribute) + { + return Message(sourceLineNumbers, Ids.ExpectedAttributeOrElementWithoutOtherAttribute, "Element '{0}' missing attribute '{1}' or child element '{2}'. Exactly one of those is required when attribute '{3}' is not specified.", parentElement, attribute, childElement, otherAttribute); + } + public static Message ExpectedAttributes(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2) { return Message(sourceLineNumbers, Ids.ExpectedAttributes, "The {0} element's {1} or {2} attribute was not found; one of these is required.", elementName, attributeName1, attributeName2); @@ -839,7 +854,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.IllegalAttributeWithoutOtherAttributes, "The {0}/@{1} attribute can only be specified with one of the following attributes: {2} or {3} present.", elementName, attributeName, otherAttributeName1, otherAttributeName2); } - public static Message IllegalAttributeWithoutOtherAttributes(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string otherAttributeName1, string otherAttributeName2, string otherAttributeValue, Boolean uniquifier) + public static Message IllegalAttributeWithoutOtherAttributes(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string otherAttributeName1, string otherAttributeName2, string otherAttributeValue, bool uniquifier) { return Message(sourceLineNumbers, Ids.IllegalAttributeWithoutOtherAttributes, "The {0}/@{1} attribute can only be specified with one of the following attributes: {2} or {3} present with value '{4}'.", elementName, attributeName, otherAttributeName1, otherAttributeName2, otherAttributeValue, uniquifier); } @@ -899,7 +914,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.IllegalComponentWithAutoGeneratedGuid, "The Component/@Guid attribute's value '*' is not valid for this component because it does not meet the criteria for having an automatically generated guid. Components using a Directory as a KeyPath or containing ODBCDataSource child elements cannot use an automatically generated guid. Make sure your component doesn't have a Directory as the KeyPath and move any ODBCDataSource child elements to components with explicit component guids."); } - public static Message IllegalComponentWithAutoGeneratedGuid(SourceLineNumber sourceLineNumbers, Boolean registryKeyPath) + public static Message IllegalComponentWithAutoGeneratedGuid(SourceLineNumber sourceLineNumbers, bool registryKeyPath) { return Message(sourceLineNumbers, Ids.IllegalComponentWithAutoGeneratedGuid, "The Component/@Guid attribute's value '*' is not valid for this component because it does not meet the criteria for having an automatically generated guid. Components with registry keypaths and files cannot use an automatically generated guid. Create multiple components, each with one file and/or one registry value keypath, to use automatically generated guids.", registryKeyPath); } @@ -1414,12 +1429,12 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.MergeFeatureRequired, "The {0} table contains a row with primary key(s) '{1}' which requires a feature to properly merge from the merge module '{2}'. Nest a MergeRef element with an Id attribute set to the value '{3}' under a Feature element to fix this error.", tableName, primaryKeys, mergeModuleFile, mergeId); } - public static Message MergeLanguageFailed(SourceLineNumber sourceLineNumbers, Int16 language, string mergeModuleFile) + public static Message MergeLanguageFailed(SourceLineNumber sourceLineNumbers, short language, string mergeModuleFile) { return Message(sourceLineNumbers, Ids.MergeLanguageFailed, "The language '{0}' is supported but uses an invalid language transform in the merge module '{1}'.", language, mergeModuleFile); } - public static Message MergeLanguageUnsupported(SourceLineNumber sourceLineNumbers, Int16 language, string mergeModuleFile) + public static Message MergeLanguageUnsupported(SourceLineNumber sourceLineNumbers, short language, string mergeModuleFile) { return Message(sourceLineNumbers, Ids.MergeLanguageUnsupported, "Could not locate language '{0}' (or a transform for this language) in the merge module '{1}'. This is likely due to an incorrectly authored Merge/@Language attribute.", language, mergeModuleFile); } @@ -2710,6 +2725,8 @@ namespace WixToolset.Data MsiTransactionX86BeforeX64Package2 = 410, MsiTransactionInvalidPackage = 411, MsiTransactionInvalidPackage2 = 412, + ExpectedAttributeOrElementWithOtherAttribute = 413, + ExpectedAttributeOrElementWithoutOtherAttribute = 414, } } } diff --git a/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs index 6cf200c2..74146716 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixBundleExePackageSymbol.cs @@ -16,6 +16,9 @@ namespace WixToolset.Data new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.RepairCommand), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.UninstallCommand), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ExeProtocol), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.DetectionType), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ArpId), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixBundleExePackageSymbolFields.ArpDisplayVersion), IntermediateFieldType.String), }, typeof(WixBundleExePackageSymbol)); } @@ -33,6 +36,19 @@ namespace WixToolset.Data.Symbols RepairCommand, UninstallCommand, ExeProtocol, + DetectionType, + ArpId, + ArpDisplayVersion, + } + + /// + /// How Burn will detect the ExePackage. + /// + public enum WixBundleExePackageDetectionType + { + None, + Condition, + Arp, } [Flags] @@ -40,6 +56,7 @@ namespace WixToolset.Data.Symbols { None = 0, Bundle = 1, + ArpWin64 = 2, } public class WixBundleExePackageSymbol : IntermediateSymbol @@ -90,6 +107,24 @@ namespace WixToolset.Data.Symbols set => this.Set((int)WixBundleExePackageSymbolFields.ExeProtocol, value); } + public WixBundleExePackageDetectionType DetectionType + { + get => (WixBundleExePackageDetectionType)this.Fields[(int)WixBundleExePackageSymbolFields.DetectionType].AsNumber(); + set => this.Set((int)WixBundleExePackageSymbolFields.DetectionType, (int)value); + } + + public string ArpId + { + get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.ArpId]; + set => this.Set((int)WixBundleExePackageSymbolFields.ArpId, value); + } + + public string ArpDisplayVersion + { + get => (string)this.Fields[(int)WixBundleExePackageSymbolFields.ArpDisplayVersion]; + set => this.Set((int)WixBundleExePackageSymbolFields.ArpDisplayVersion, value); + } + public bool IsBundle { get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.Bundle); } @@ -106,6 +141,22 @@ namespace WixToolset.Data.Symbols } } + public bool ArpWin64 + { + get { return this.Attributes.HasFlag(WixBundleExePackageAttributes.ArpWin64); } + set + { + if (value) + { + this.Attributes |= WixBundleExePackageAttributes.ArpWin64; + } + else + { + this.Attributes &= ~WixBundleExePackageAttributes.ArpWin64; + } + } + } + public bool Repairable => this.RepairCommand != null; public bool Uninstallable => this.UninstallCommand != null; diff --git a/src/api/wix/WixToolset.Data/WarningMessages.cs b/src/api/wix/WixToolset.Data/WarningMessages.cs index 5a5d1e79..5d3f06f8 100644 --- a/src/api/wix/WixToolset.Data/WarningMessages.cs +++ b/src/api/wix/WixToolset.Data/WarningMessages.cs @@ -237,6 +237,11 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.DetectConditionRecommended, "The {0}/@DetectCondition attribute is recommended so the package is only installed when absent.", elementName); } + public static Message ExePackageDetectInformationRecommended(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.ExePackageDetectInformationRecommended, "The ExePackage/@DetectCondition attribute or child element ArpEntry is recommended so the package is only installed when absent."); + } + public static Message DownloadUrlNotSupportedForAttachedContainers(SourceLineNumber sourceLineNumbers, string containerId) { return Message(sourceLineNumbers, Ids.DownloadUrlNotSupportedForAttachedContainers, "The Container '{0}' is attached but included a @DownloadUrl attribute. Attached Containers cannot be downloaded so the download URL is being ignored.", containerId); @@ -267,7 +272,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.EmptyCabinet, "The cabinet '{0}' does not contain any files. If this installation contains no files, this warning can likely be safely ignored. Otherwise, please add files to the cabinet or remove it.", cabinetName); } - public static Message EmptyCabinet(SourceLineNumber sourceLineNumbers, string cabinetName, Boolean isPatch) + public static Message EmptyCabinet(SourceLineNumber sourceLineNumbers, string cabinetName, bool isPatch) { return Message(sourceLineNumbers, Ids.EmptyCabinet, "The cabinet '{0}' does not contain any files. If this patch contains no files, this warning can likely be safely ignored. Otherwise, try passing -p to torch.exe when first building the transforms, or add a ComponentRef to your PatchFamily authoring to pull changed files into the cabinet.", cabinetName, isPatch); } @@ -322,7 +327,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.IllegalActionInSequence, "The {0} table contains an action '{1}' which is not allowed in this table. If this is a standard action then it is not valid for this table, if it is a custom action or dialog then this table does not accept actions of that type. This action will be left out of the decompiled output.", sequenceTableName, actionName); } - public static Message IllegalColumnValue(SourceLineNumber sourceLineNumbers, string tableName, string columnName, Object value) + public static Message IllegalColumnValue(SourceLineNumber sourceLineNumbers, string tableName, string columnName, object value) { return Message(sourceLineNumbers, Ids.IllegalColumnValue, "The {0}.{1} column's value, '{2}', is not a recognized legal value. This information will be left out of the decompiled output.", tableName, columnName, value); } @@ -407,7 +412,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.MsiTransactionLimitations, "MSI transactions have limitations that make it hard to use them successfully in a bundle. Test the bundle thoroughly, especially in upgrade scenarios and the scenario that required them in the first place."); } - public static Message NestedInstall(SourceLineNumber sourceLineNumbers, string tableName, string columnName, Object value) + public static Message NestedInstall(SourceLineNumber sourceLineNumbers, string tableName, string columnName, object value) { return Message(sourceLineNumbers, Ids.NestedInstall, "The {0}.{1} column's value, '{2}', indicates a nested install. Nested installations are not supported by the WiX team. This action will be left out of the decompiled output.", tableName, columnName, value); } @@ -628,7 +633,7 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.UnknownPermission, "The {0} table contains a row with primary key '{1}' which has an unknown permission at bit {2}.", tableName, primaryKey, bitPosition); } - public static Message UnrepresentableColumnValue(SourceLineNumber sourceLineNumbers, string tableName, string columnName, Object value) + public static Message UnrepresentableColumnValue(SourceLineNumber sourceLineNumbers, string tableName, string columnName, object value) { return Message(sourceLineNumbers, Ids.UnrepresentableColumnValue, "The {0}.{1} column's value, '{2}', cannot currently be represented in the WiX schema.", tableName, columnName, value); } @@ -688,6 +693,11 @@ namespace WixToolset.Data return Message(sourceLineNumbers, Ids.WindowsInstallerFileTooLarge, "The Windows Installer does not support {0} files larger than 2GB in size. Reduce the size or number of files embedded in '{1}' or the installation will likely fail with an unexpected error.", fileDescription, path); } + public static Message InvalidWixVersion(SourceLineNumber sourceLineNumbers, string version, string elementName, string attributeName) + { + return Message(sourceLineNumbers, Ids.InvalidWixVersion, "Invalid WixVersion '{0}' in {1}/@'{2}'. Comparisons may yield unexpected results.", version, elementName, attributeName); + } + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) { return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); @@ -827,6 +837,8 @@ namespace WixToolset.Data WindowsInstallerFileTooLarge = 1158, UnavailableBundleConditionVariable = 1159, DiscardedRollbackBoundary2 = 1160, + ExePackageDetectInformationRecommended = 1161, + InvalidWixVersion = 1162, } } } -- cgit v1.2.3-55-g6feb