main
cs 72 lines 4.42 KB
Raw
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
4 {
5 using WixToolset.Data;
6
7 internal static class CompilerWarnings
8 {
9 public static Message DirectoryRefStandardDirectoryDeprecated(SourceLineNumber sourceLineNumbers, string directoryId)
10 {
11 return Message(sourceLineNumbers, Ids.DirectoryRefStandardDirectoryDeprecated, "Using DirectoryRef to reference the standard directory '{0}' is deprecated. Use the StandardDirectory element instead.", directoryId);
12 }
13
14 public static Message DefiningStandardDirectoryDeprecated(SourceLineNumber sourceLineNumbers, string directoryId)
15 {
16 return Message(sourceLineNumbers, Ids.DefiningStandardDirectoryDeprecated, "It is no longer necessary to define the standard directory '{0}'. Use the StandardDirectory element instead.", directoryId);
17 }
18
19 public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers)
20 {
21 return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default.");
22 }
23
24 public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers, string id)
25 {
26 return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default.", id);
27 }
28
29 public static Message PropertyRemoved(string name)
30 {
31 return Message(null, Ids.PropertyRemoved, "The property {0} was authored in the package with a value and will be removed. The property should not be authored.", name);
32 }
33
34 public static Message ProvidesKeyNotFound(SourceLineNumber sourceLineNumbers, string id)
35 {
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 }
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
44 public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id)
45 {
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);
47 }
48
49 public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId)
50 {
51 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);
52 }
53
54 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
55 {
56 return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args);
57 }
58
59 public enum Ids
60 {
61 ProvidesKeyNotFound = 5431,
62 RequiresKeyNotFound = 5432,
63 PropertyRemoved = 5433,
64 DiscouragedVersionAttribute = 5434,
65 Win64Component = 5435,
66 DirectoryRefStandardDirectoryDeprecated = 5436,
67 DefiningStandardDirectoryDeprecated = 5437,
68 ReadonlyLogVariableTarget = 5438,
69 // DO_NOT_REUSE ReservedBurnNamespaceWarning = 5439,
70 } // 5400-5499 and 6600-6699 were the ranges for Dependency and Tag which are now in Core between CompilerWarnings and CompilerErrors.
71 }
72 }