| 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.Core.Burn |
| 4 | { |
| 5 | using System; |
| 6 | using WixToolset.Data; |
| 7 | using WixToolset.Data.Symbols; |
| 8 | |
| 9 | internal static class BurnBackendErrors |
| 10 | { |
| 11 | public static Message BAContainerPayloadCollision(SourceLineNumber sourceLineNumbers, string payloadId, string payloadName) |
| 12 | { |
| 13 | return Message(sourceLineNumbers, Ids.BAContainerPayloadCollision, "The Payload '{0}' has a duplicate Name '{1}' in the BA container. When extracting the container at runtime, the file will get overwritten.", payloadId, payloadName); |
| 14 | } |
| 15 | |
| 16 | public static Message BAContainerPayloadCollision2(SourceLineNumber sourceLineNumbers) |
| 17 | { |
| 18 | return Message(sourceLineNumbers, Ids.BAContainerPayloadCollision2, "The location of the payload related to the previous error."); |
| 19 | } |
| 20 | |
| 21 | public static Message BundleMultipleProviders(SourceLineNumber sourceLineNumbers, string extraProviderKey, string originalProviderKey) |
| 22 | { |
| 23 | return Message(sourceLineNumbers, Ids.BundleMultipleProviders, "The bundle can only have a single dependency provider, but it has '{0}' and '{1}'.", originalProviderKey, extraProviderKey); |
| 24 | } |
| 25 | |
| 26 | public static Message DuplicateCacheIds(SourceLineNumber originalLineNumber, string cacheId, string packageId) |
| 27 | { |
| 28 | return Message(originalLineNumber, Ids.DuplicateCacheIds, "The CacheId '{0}' for package '{1}' is duplicated. Each package must have a unique CacheId.", cacheId, packageId); |
| 29 | } |
| 30 | |
| 31 | public static Message DuplicateCacheIds2(SourceLineNumber duplicateLineNumber) |
| 32 | { |
| 33 | return Message(duplicateLineNumber, Ids.DuplicateCacheIds2, "The location of the package related to the previous error."); |
| 34 | } |
| 35 | |
| 36 | public static Message ExternalPayloadCollision(SourceLineNumber sourceLineNumbers, string symbolName, string payloadId, string payloadName) |
| 37 | { |
| 38 | return Message(sourceLineNumbers, Ids.ExternalPayloadCollision, "The external {0} '{1}' has a duplicate Name '{2}'. When building the bundle or laying out the bundle, the file will get overwritten.", symbolName, payloadId, payloadName); |
| 39 | } |
| 40 | |
| 41 | public static Message ExternalPayloadCollision2(SourceLineNumber sourceLineNumbers) |
| 42 | { |
| 43 | return Message(sourceLineNumbers, Ids.ExternalPayloadCollision2, "The location of the symbol related to the previous error."); |
| 44 | } |
| 45 | |
| 46 | public static Message FailedToUpdateBundleResources(SourceLineNumber sourceLineNumbers, string iconPath, string splashScreenPath, string detail) |
| 47 | { |
| 48 | var additionalDetail = String.Empty; |
| 49 | |
| 50 | if (String.IsNullOrEmpty(iconPath) && String.IsNullOrEmpty(splashScreenPath)) |
| 51 | { |
| 52 | } |
| 53 | else if (String.IsNullOrEmpty(iconPath)) |
| 54 | { |
| 55 | additionalDetail = $" Ensure the splash screen file is a bitmap file at '{splashScreenPath}'."; |
| 56 | } |
| 57 | else if (String.IsNullOrEmpty(splashScreenPath)) |
| 58 | { |
| 59 | additionalDetail = $" Ensure the bundle icon file is an icon file at '{iconPath}'."; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | additionalDetail = $" Ensure the bundle icon file is an icon file at '{iconPath}' and the splash screen file is a bitmap file at '{splashScreenPath}'."; |
| 64 | } |
| 65 | |
| 66 | return Message(sourceLineNumbers, Ids.FailedToUpdateBundleResources, "Failed to update resources in the bundle.{0} Detail: {1}", additionalDetail, detail); |
| 67 | } |
| 68 | |
| 69 | public static Message PackageCachePayloadCollision(SourceLineNumber sourceLineNumbers, string payloadId, string payloadName, string packageId) |
| 70 | { |
| 71 | return Message(sourceLineNumbers, Ids.PackageCachePayloadCollision, "The Payload '{0}' has a duplicate Name '{1}' in package '{2}'. When caching the package, the file will get overwritten.", payloadId, payloadName, packageId); |
| 72 | } |
| 73 | |
| 74 | public static Message PackageCachePayloadCollision2(SourceLineNumber sourceLineNumbers) |
| 75 | { |
| 76 | return Message(sourceLineNumbers, Ids.PackageCachePayloadCollision2, "The location of the payload related to the previous error."); |
| 77 | } |
| 78 | |
| 79 | public static Message TooManyAttachedContainers(uint maxAllowed) |
| 80 | { |
| 81 | return Message(null, Ids.TooManyAttachedContainers, "The bundle has too many attached containers. The maximal attached container count is {0}", maxAllowed); |
| 82 | } |
| 83 | |
| 84 | public static Message IncompatibleWixBurnSection(string bundleExecutable, long bundleVersion) |
| 85 | { |
| 86 | return Message(null, Ids.IncompatibleWixBurnSection, "Unable to read bundle executable '{0}', because this bundle was created with a different version of WiX burn (.wixburn section version '{1}'). You must use the same version of Windows Installer XML in order to read this bundle.", bundleExecutable, bundleVersion); |
| 87 | } |
| 88 | |
| 89 | public static Message UnsupportedRemotePackagePayload(string extension, string path) |
| 90 | { |
| 91 | return Message(null, Ids.UnsupportedRemotePackagePayload, "The first remote payload must be a supported package type of .exe or .msu. Use the -packageType switch to override the inferred extension: {0} from file: {1}", extension, path); |
| 92 | } |
| 93 | |
| 94 | public static Message InvalidBundleManifest(SourceLineNumber sourceLineNumbers, string bundleExecutable, string reason) |
| 95 | { |
| 96 | return Message(sourceLineNumbers, Ids.InvalidBundleManifest, "Unable to read bundle executable '{0}'. Its manifest is invalid. {1}", bundleExecutable, reason); |
| 97 | } |
| 98 | |
| 99 | public static Message MultipleSingletonSymbolsFound(SourceLineNumber sourceLineNumbers, string friendlyName, SourceLineNumber collisionSourceLineNumbers) |
| 100 | { |
| 101 | return Message(sourceLineNumbers, Ids.MultipleSingletonSymbolsFound, "The Bundle requires a single {0}, but found another at: {1}", friendlyName, collisionSourceLineNumbers.ToString()); |
| 102 | } |
| 103 | |
| 104 | public static Message MissingPrimaryBootstrapperApplication() |
| 105 | { |
| 106 | return Message(null, Ids.MissingPrimaryBootstrapperApplication, "A BundleApplication is required to build a bundle."); |
| 107 | } |
| 108 | |
| 109 | public static Message TooManyBootstrapperApplications(SourceLineNumber sourceLineNumbers, WixBootstrapperApplicationSymbol symbol) |
| 110 | { |
| 111 | var secondary = symbol.Secondary == true ? "secondary " : String.Empty; |
| 112 | |
| 113 | return Message(sourceLineNumbers, Ids.MultipleSingletonSymbolsFound, "Multiple {0}BootstrapperApplications defined. You can have at most one BootstrapperAppplication of primary and secondary.", secondary); |
| 114 | } |
| 115 | |
| 116 | public static Message BundleMissingBootstrapperApplicationContainer(SourceLineNumber sourceLineNumbers, string path) |
| 117 | { |
| 118 | return Message(sourceLineNumbers, Ids.BundleMissingBootstrapperApplicationContainer, "Bundle is invalid. The BootstrapperApplication attached container is missing from the file: {0}", path); |
| 119 | } |
| 120 | |
| 121 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 122 | { |
| 123 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); |
| 124 | } |
| 125 | |
| 126 | public enum Ids |
| 127 | { |
| 128 | DuplicateCacheIds = 8000, |
| 129 | DuplicateCacheIds2 = 8001, |
| 130 | BAContainerPayloadCollision = 8002, |
| 131 | BAContainerPayloadCollision2 = 8003, |
| 132 | ExternalPayloadCollision = 8004, |
| 133 | ExternalPayloadCollision2 = 8005, |
| 134 | PackageCachePayloadCollision = 8006, |
| 135 | PackageCachePayloadCollision2 = 8007, |
| 136 | TooManyAttachedContainers = 8008, |
| 137 | IncompatibleWixBurnSection = 8009, |
| 138 | UnsupportedRemotePackagePayload = 8010, |
| 139 | FailedToUpdateBundleResources = 8011, |
| 140 | InvalidBundleManifest = 8012, |
| 141 | BundleMultipleProviders = 8013, |
| 142 | MultipleSingletonSymbolsFound = 8014, |
| 143 | MissingPrimaryBootstrapperApplication = 8015, |
| 144 | TooManyBootstrapperApplications = 8016, |
| 145 | BundleMissingBootstrapperApplicationContainer = 8017, |
| 146 | } // last available is 8499. 8500 is BurnBackendWarnings. |
| 147 | } |
| 148 | } |