diff options
author | Rob Mensching <rob@firegiant.com> | 2023-12-06 19:48:54 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2023-12-16 14:32:21 -0800 |
commit | eff9d4204880535f821827e5aece5068402358f6 (patch) | |
tree | 11b8158605bf2853242321fbaf2880792cb8d6b5 /src | |
parent | 379926377524951c692e8c342a49fb03da61345f (diff) | |
download | wix-eff9d4204880535f821827e5aece5068402358f6.tar.gz wix-eff9d4204880535f821827e5aece5068402358f6.tar.bz2 wix-eff9d4204880535f821827e5aece5068402358f6.zip |
Introducing the WiX Standard Library
Completes 7914
Diffstat (limited to 'src')
18 files changed, 292 insertions, 267 deletions
diff --git a/src/api/wix/WixToolset.Data/Intermediate.cs b/src/api/wix/WixToolset.Data/Intermediate.cs index 64f9810d..977f894a 100644 --- a/src/api/wix/WixToolset.Data/Intermediate.cs +++ b/src/api/wix/WixToolset.Data/Intermediate.cs | |||
@@ -215,9 +215,11 @@ namespace WixToolset.Data | |||
215 | /// Updates the intermediate level to the specified level. | 215 | /// Updates the intermediate level to the specified level. |
216 | /// </summary> | 216 | /// </summary> |
217 | /// <param name="level">Intermediate level.</param> | 217 | /// <param name="level">Intermediate level.</param> |
218 | public void UpdateLevel(string level) | 218 | public Intermediate UpdateLevel(string level) |
219 | { | 219 | { |
220 | this.Level = String.IsNullOrEmpty(this.Level) ? level : String.Concat(this.Level, ";", level); | 220 | this.Level = String.IsNullOrEmpty(this.Level) ? level : String.Concat(this.Level, ";", level); |
221 | |||
222 | return this; | ||
221 | } | 223 | } |
222 | 224 | ||
223 | /// <summary> | 225 | /// <summary> |
diff --git a/src/api/wix/WixToolset.Data/IntermediateSection.cs b/src/api/wix/WixToolset.Data/IntermediateSection.cs index b9157875..16d63a4c 100644 --- a/src/api/wix/WixToolset.Data/IntermediateSection.cs +++ b/src/api/wix/WixToolset.Data/IntermediateSection.cs | |||
@@ -70,9 +70,11 @@ namespace WixToolset.Data | |||
70 | /// Assigns the section to a library. | 70 | /// Assigns the section to a library. |
71 | /// </summary> | 71 | /// </summary> |
72 | /// <param name="libraryId">Identifier of the library.</param> | 72 | /// <param name="libraryId">Identifier of the library.</param> |
73 | public void AssignToLibrary(string libraryId) | 73 | public IntermediateSection AssignToLibrary(string libraryId) |
74 | { | 74 | { |
75 | this.LibraryId = libraryId; | 75 | this.LibraryId = libraryId; |
76 | |||
77 | return this; | ||
76 | } | 78 | } |
77 | 79 | ||
78 | /// <summary> | 80 | /// <summary> |
diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs index 17267cf7..971a0416 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/WindowsInstallerStandard.cs | |||
@@ -11,7 +11,6 @@ namespace WixToolset.Data.WindowsInstaller | |||
11 | { | 11 | { |
12 | private static readonly Dictionary<string, WixActionSymbol> standardActionsById; | 12 | private static readonly Dictionary<string, WixActionSymbol> standardActionsById; |
13 | private static readonly HashSet<string> standardActionNames; | 13 | private static readonly HashSet<string> standardActionNames; |
14 | private static readonly Dictionary<string, DirectorySymbol> standardDirectoriesById; | ||
15 | 14 | ||
16 | /// <summary> | 15 | /// <summary> |
17 | /// References: | 16 | /// References: |
@@ -208,6 +207,41 @@ namespace WixToolset.Data.WindowsInstaller | |||
208 | "WindowsVolume", | 207 | "WindowsVolume", |
209 | }; | 208 | }; |
210 | 209 | ||
210 | private static readonly Dictionary<string, string> standardDirectoryNamesById = new Dictionary<string, string> | ||
211 | { | ||
212 | ["TARGETDIR"] = "SourceDir", | ||
213 | ["AdminToolsFolder"] = "Admin", | ||
214 | ["AppDataFolder"] = "AppData", | ||
215 | ["CommonAppDataFolder"] = "CommApp", | ||
216 | ["CommonFilesFolder"] = "CFiles", | ||
217 | ["CommonFiles64Folder"] = "CFiles64", | ||
218 | ["CommonFiles6432Folder"] = ".", | ||
219 | ["DesktopFolder"] = "Desktop", | ||
220 | ["FavoritesFolder"] = "Favs", | ||
221 | ["FontsFolder"] = "Fonts", | ||
222 | ["LocalAppDataFolder"] = "LocalApp", | ||
223 | ["MyPicturesFolder"] = "Pictures", | ||
224 | ["NetHoodFolder"] = "NetHood", | ||
225 | ["PersonalFolder"] = "Personal", | ||
226 | ["PrintHoodFolder"] = "Printers", | ||
227 | ["ProgramFilesFolder"] = "PFiles", | ||
228 | ["ProgramFiles64Folder"] = "PFiles64", | ||
229 | ["ProgramFiles6432Folder"] = ".", | ||
230 | ["ProgramMenuFolder"] = "PMenu", | ||
231 | ["RecentFolder"] = "Recent", | ||
232 | ["SendToFolder"] = "SendTo", | ||
233 | ["StartMenuFolder"] = "StrtMenu", | ||
234 | ["StartupFolder"] = "StartUp", | ||
235 | ["SystemFolder"] = "System", | ||
236 | ["System16Folder"] = "System16", | ||
237 | ["System64Folder"] = "System64", | ||
238 | ["System6432Folder"] = ".", | ||
239 | ["TempFolder"] = "Temp", | ||
240 | ["TemplateFolder"] = "Template", | ||
241 | ["WindowsFolder"] = "Windows", | ||
242 | }; | ||
243 | |||
244 | |||
211 | static WindowsInstallerStandard() | 245 | static WindowsInstallerStandard() |
212 | { | 246 | { |
213 | var standardActions = new[] | 247 | var standardActions = new[] |
@@ -332,43 +366,8 @@ namespace WixToolset.Data.WindowsInstaller | |||
332 | new WixActionSymbol(null, new Identifier(AccessModifier.Virtual, "InstallExecuteSequence/InstallFinalize")) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.InstallExecuteSequence }, | 366 | new WixActionSymbol(null, new Identifier(AccessModifier.Virtual, "InstallExecuteSequence/InstallFinalize")) { Action="InstallFinalize", Sequence=6600, SequenceTable=SequenceTable.InstallExecuteSequence }, |
333 | }; | 367 | }; |
334 | 368 | ||
335 | var standardDirectories = new[] | ||
336 | { | ||
337 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TARGETDIR")) { Name = "SourceDir" }, | ||
338 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "AdminToolsFolder")) { Name = "Admin" }, | ||
339 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "AppDataFolder")) { Name = "AppData" }, | ||
340 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonAppDataFolder")) { Name = "CommApp" }, | ||
341 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFilesFolder")) { Name = "CFiles" }, | ||
342 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFiles64Folder")) { Name = "CFiles64" }, | ||
343 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "CommonFiles6432Folder")) { Name = "." }, | ||
344 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "DesktopFolder")) { Name = "Desktop" }, | ||
345 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "FavoritesFolder")) { Name = "Favs" }, | ||
346 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "FontsFolder")) { Name = "Fonts" }, | ||
347 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "LocalAppDataFolder")) { Name = "LocalApp" }, | ||
348 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "MyPicturesFolder")) { Name = "Pictures" }, | ||
349 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "NetHoodFolder")) { Name = "NetHood" }, | ||
350 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "PersonalFolder")) { Name = "Personal" }, | ||
351 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "PrintHoodFolder")) { Name = "Printers" }, | ||
352 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFilesFolder")) { Name = "PFiles" }, | ||
353 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFiles64Folder")) { Name = "PFiles64" }, | ||
354 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramFiles6432Folder")) { Name = "." }, | ||
355 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "ProgramMenuFolder")) { Name = "PMenu" }, | ||
356 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "RecentFolder")) { Name = "Recent" }, | ||
357 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "SendToFolder")) { Name = "SendTo" }, | ||
358 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "StartMenuFolder")) { Name = "StrtMenu" }, | ||
359 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "StartupFolder")) { Name = "StartUp" }, | ||
360 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "SystemFolder")) { Name = "System" }, | ||
361 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System16Folder")) { Name = "System16" }, | ||
362 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System64Folder")) { Name = "System64" }, | ||
363 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "System6432Folder")) { Name = "." }, | ||
364 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TempFolder")) { Name = "Temp" }, | ||
365 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "TemplateFolder")) { Name = "Template" }, | ||
366 | new DirectorySymbol(null, new Identifier(AccessModifier.Virtual, "WindowsFolder")) { Name = "Windows" }, | ||
367 | }; | ||
368 | |||
369 | standardActionNames = new HashSet<string>(standardActions.Select(a => a.Action)); | 369 | standardActionNames = new HashSet<string>(standardActions.Select(a => a.Action)); |
370 | standardActionsById = standardActions.ToDictionary(a => a.Id.Id); | 370 | standardActionsById = standardActions.ToDictionary(a => a.Id.Id); |
371 | standardDirectoriesById = standardDirectories.ToDictionary(d => d.Id.Id); | ||
372 | } | 371 | } |
373 | 372 | ||
374 | /// <summary> | 373 | /// <summary> |
@@ -376,17 +375,26 @@ namespace WixToolset.Data.WindowsInstaller | |||
376 | /// </summary> | 375 | /// </summary> |
377 | /// <param name="actionName">Name of the action.</param> | 376 | /// <param name="actionName">Name of the action.</param> |
378 | /// <returns>true if the action is standard, false otherwise.</returns> | 377 | /// <returns>true if the action is standard, false otherwise.</returns> |
379 | public static bool IsStandardAction(string actionName) => standardActionNames.Contains(actionName); | 378 | public static bool IsStandardAction(string actionName) |
379 | { | ||
380 | return standardActionNames.Contains(actionName); | ||
381 | } | ||
380 | 382 | ||
381 | /// <summary> | 383 | /// <summary> |
382 | /// Standard actions. | 384 | /// Standard actions. |
383 | /// </summary> | 385 | /// </summary> |
384 | public static IReadOnlyCollection<WixActionSymbol> StandardActions() => standardActionsById.Values; | 386 | public static IReadOnlyCollection<WixActionSymbol> StandardActions() |
387 | { | ||
388 | return standardActionsById.Values; | ||
389 | } | ||
385 | 390 | ||
386 | /// <summary> | 391 | /// <summary> |
387 | /// Standard directories. | 392 | /// Standard directory identifiers. |
388 | /// </summary> | 393 | /// </summary> |
389 | public static IReadOnlyCollection<DirectorySymbol> StandardDirectories() => standardDirectoriesById.Values; | 394 | public static IReadOnlyCollection<string> StandardDirectoryIds() |
395 | { | ||
396 | return standardDirectoryNamesById.Keys; | ||
397 | } | ||
390 | 398 | ||
391 | /// <summary> | 399 | /// <summary> |
392 | /// Gets the platform specific directory id for a directory. Most directories are not platform | 400 | /// Gets the platform specific directory id for a directory. Most directories are not platform |
@@ -418,28 +426,43 @@ namespace WixToolset.Data.WindowsInstaller | |||
418 | /// </summary> | 426 | /// </summary> |
419 | /// <param name="directoryId">Name of the directory.</param> | 427 | /// <param name="directoryId">Name of the directory.</param> |
420 | /// <returns>true if the directory is standard, false otherwise.</returns> | 428 | /// <returns>true if the directory is standard, false otherwise.</returns> |
421 | public static bool IsStandardDirectory(string directoryId) => standardDirectoriesById.ContainsKey(directoryId); | 429 | public static bool IsStandardDirectory(string directoryId) |
430 | { | ||
431 | return standardDirectoryNamesById.ContainsKey(directoryId); | ||
432 | } | ||
422 | 433 | ||
423 | /// <summary> | 434 | /// <summary> |
424 | /// Find out if a property is a standard property. | 435 | /// Find out if a property is a standard property. |
425 | /// </summary> | 436 | /// </summary> |
426 | /// <param name="propertyName">Name of the property.</param> | 437 | /// <param name="propertyName">Name of the property.</param> |
427 | /// <returns>true if a property is standard, false otherwise.</returns> | 438 | /// <returns>true if a property is standard, false otherwise.</returns> |
428 | public static bool IsStandardProperty(string propertyName) => standardProperties.Contains(propertyName); | 439 | public static bool IsStandardProperty(string propertyName) |
440 | { | ||
441 | return standardProperties.Contains(propertyName); | ||
442 | } | ||
429 | 443 | ||
430 | /// <summary> | 444 | /// <summary> |
431 | /// Try to get standard action by id. | 445 | /// Try to get standard action by id. |
432 | /// </summary> | 446 | /// </summary> |
433 | public static bool TryGetStandardAction(string id, out WixActionSymbol standardAction) => standardActionsById.TryGetValue(id, out standardAction); | 447 | public static bool TryGetStandardAction(string id, out WixActionSymbol standardAction) |
448 | { | ||
449 | return standardActionsById.TryGetValue(id, out standardAction); | ||
450 | } | ||
434 | 451 | ||
435 | /// <summary> | 452 | /// <summary> |
436 | /// Try to get standard action by sequence and action name. | 453 | /// Try to get standard action by sequence and action name. |
437 | /// </summary> | 454 | /// </summary> |
438 | public static bool TryGetStandardAction(string sequenceName, string actioname, out WixActionSymbol standardAction) => standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction); | 455 | public static bool TryGetStandardAction(string sequenceName, string actioname, out WixActionSymbol standardAction) |
456 | { | ||
457 | return standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction); | ||
458 | } | ||
439 | 459 | ||
440 | /// <summary> | 460 | /// <summary> |
441 | /// Try to get standard directory symbol by id. | 461 | /// Try to get standard directory name by id. |
442 | /// </summary> | 462 | /// </summary> |
443 | public static bool TryGetStandardDirectory(string directoryId, out DirectorySymbol symbol) => standardDirectoriesById.TryGetValue(directoryId, out symbol); | 463 | public static bool TryGetStandardDirectoryName(string directoryId, out string name) |
464 | { | ||
465 | return standardDirectoryNamesById.TryGetValue(directoryId, out name); | ||
466 | } | ||
444 | } | 467 | } |
445 | } | 468 | } |
diff --git a/src/api/wix/WixToolset.Data/WixStandardLibrary.cs b/src/api/wix/WixToolset.Data/WixStandardLibrary.cs new file mode 100644 index 00000000..c5c9d8d4 --- /dev/null +++ b/src/api/wix/WixToolset.Data/WixStandardLibrary.cs | |||
@@ -0,0 +1,152 @@ | |||
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.Data | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Linq; | ||
8 | using WixToolset.Data.Bind; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Data.WindowsInstaller; | ||
11 | |||
12 | /// <summary> | ||
13 | /// WiX Standard Library implementation. | ||
14 | /// </summary> | ||
15 | public static class WixStandardLibrary | ||
16 | { | ||
17 | private const string WixStandardLibraryId = "wixstd"; | ||
18 | |||
19 | /// <summary> | ||
20 | /// Build the wixstd.wixlib Intermediate. | ||
21 | /// </summary> | ||
22 | /// <param name="platform">Target platform for the wixstd.wixlib</param> | ||
23 | /// <returns>Intermediate containing the wixstd.wixlib.</returns> | ||
24 | public static Intermediate Build(Platform platform) | ||
25 | { | ||
26 | var localizations = YieldLocalizations(); | ||
27 | |||
28 | var sections = YieldSections(platform); | ||
29 | |||
30 | return new Intermediate(WixStandardLibraryId, IntermediateLevels.Combined, sections, localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); | ||
31 | } | ||
32 | |||
33 | private static IEnumerable<Localization> YieldLocalizations() | ||
34 | { | ||
35 | var strings = new BindVariable[0]; | ||
36 | |||
37 | var localizedControls = new LocalizedControl[0]; | ||
38 | |||
39 | yield return new Localization(LocalizationLocation.Library, null, null, String.Empty, strings.ToDictionary(s => s.Id), localizedControls.ToDictionary(l => l.GetKey())); | ||
40 | } | ||
41 | |||
42 | private static IEnumerable<IntermediateSection> YieldSections(Platform platform) | ||
43 | { | ||
44 | var sourceLineNumber = new SourceLineNumber("wixstd.wixlib"); | ||
45 | |||
46 | // Actions. | ||
47 | foreach (var actionSymbol in WindowsInstallerStandard.StandardActions()) | ||
48 | { | ||
49 | var symbol = new WixActionSymbol(sourceLineNumber, new Identifier(actionSymbol.Id.Access, actionSymbol.Id.Id)) | ||
50 | { | ||
51 | Action = actionSymbol.Action, | ||
52 | SequenceTable = actionSymbol.SequenceTable, | ||
53 | Sequence = actionSymbol.Sequence, | ||
54 | Condition = actionSymbol.Condition, | ||
55 | }; | ||
56 | |||
57 | var section = CreateSectionAroundSymbol(symbol); | ||
58 | |||
59 | yield return section; | ||
60 | } | ||
61 | |||
62 | // Directories. | ||
63 | foreach (var id in WindowsInstallerStandard.StandardDirectoryIds()) | ||
64 | { | ||
65 | var symbol = new DirectorySymbol(sourceLineNumber, new Identifier(AccessModifier.Virtual, id)) | ||
66 | { | ||
67 | ParentDirectoryRef = GetStandardDirectoryParent(id, platform), | ||
68 | Name = WindowsInstallerStandard.TryGetStandardDirectoryName(id, out var name) ? name : throw new InvalidOperationException("Standard directories must have a default name") | ||
69 | }; | ||
70 | |||
71 | var section = CreateSectionAroundSymbol(symbol); | ||
72 | |||
73 | // Add a reference for the more complicated parent directory references. | ||
74 | if (symbol.ParentDirectoryRef != null && symbol.ParentDirectoryRef != "TARGEDIR") | ||
75 | { | ||
76 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
77 | { | ||
78 | Table = "Directory", | ||
79 | PrimaryKeys = symbol.ParentDirectoryRef | ||
80 | }); | ||
81 | } | ||
82 | |||
83 | yield return section; | ||
84 | } | ||
85 | |||
86 | // Package References. | ||
87 | { | ||
88 | var section = CreateSection(WixStandardLibraryIdentifiers.WixStandardPackageReferences); | ||
89 | |||
90 | section.AddSymbol(new WixFragmentSymbol(sourceLineNumber, new Identifier(AccessModifier.Global, WixStandardLibraryIdentifiers.WixStandardPackageReferences))); | ||
91 | |||
92 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
93 | { | ||
94 | Table = SymbolDefinitions.Directory.Name, | ||
95 | PrimaryKeys = "TARGETDIR" | ||
96 | }); | ||
97 | |||
98 | yield return section; | ||
99 | } | ||
100 | |||
101 | // Module References. | ||
102 | { | ||
103 | var section = CreateSection(WixStandardLibraryIdentifiers.WixStandardModuleReferences); | ||
104 | |||
105 | section.AddSymbol(new WixFragmentSymbol(sourceLineNumber, new Identifier(AccessModifier.Global, WixStandardLibraryIdentifiers.WixStandardModuleReferences))); | ||
106 | |||
107 | section.AddSymbol(new WixSimpleReferenceSymbol(sourceLineNumber) | ||
108 | { | ||
109 | Table = SymbolDefinitions.Directory.Name, | ||
110 | PrimaryKeys = "TARGETDIR" | ||
111 | }); | ||
112 | |||
113 | yield return section; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | private static IntermediateSection CreateSection(string sectionId) | ||
118 | { | ||
119 | return new IntermediateSection(sectionId, SectionType.Fragment, WixStandardLibraryId).AssignToLibrary(WixStandardLibraryId); | ||
120 | } | ||
121 | |||
122 | private static IntermediateSection CreateSectionAroundSymbol(IntermediateSymbol symbol) | ||
123 | { | ||
124 | var section = CreateSection(symbol.Id.Id); | ||
125 | |||
126 | section.AddSymbol(symbol); | ||
127 | |||
128 | return section; | ||
129 | } | ||
130 | |||
131 | private static string GetStandardDirectoryParent(string directoryId, Platform platform) | ||
132 | { | ||
133 | switch (directoryId) | ||
134 | { | ||
135 | case "TARGETDIR": | ||
136 | return null; | ||
137 | |||
138 | case "CommonFiles6432Folder": | ||
139 | return platform == Platform.X86 ? "CommonFilesFolder" : "CommonFiles64Folder"; | ||
140 | |||
141 | case "ProgramFiles6432Folder": | ||
142 | return platform == Platform.X86 ? "ProgramFilesFolder" : "ProgramFiles64Folder"; | ||
143 | |||
144 | case "System6432Folder": | ||
145 | return platform == Platform.X86 ? "SystemFolder" : "System64Folder"; | ||
146 | |||
147 | default: | ||
148 | return "TARGETDIR"; | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | } | ||
diff --git a/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs b/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs new file mode 100644 index 00000000..8c4ac08e --- /dev/null +++ b/src/api/wix/WixToolset.Data/WixStandardLibraryIdentifiers.cs | |||
@@ -0,0 +1,20 @@ | |||
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.Data | ||
4 | { | ||
5 | /// <summary> | ||
6 | /// Well-known identifier names from the wixstd.wixlib. | ||
7 | /// </summary> | ||
8 | public static class WixStandardLibraryIdentifiers | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// WiX Standard references for packages. | ||
12 | /// </summary> | ||
13 | public static readonly string WixStandardPackageReferences = "WixStandardPackageReferences"; | ||
14 | |||
15 | /// <summary> | ||
16 | /// WiX Standard references for modules. | ||
17 | /// </summary> | ||
18 | public static readonly string WixStandardModuleReferences = "WixStandardModuleReferences"; | ||
19 | } | ||
20 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs index 8556d9eb..402d78fe 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/ILinkContext.cs | |||
@@ -48,6 +48,16 @@ namespace WixToolset.Extensibility.Data | |||
48 | string OutputPath { get; set; } | 48 | string OutputPath { get; set; } |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Gets or sets the platform for the output. | ||
52 | /// </summary> | ||
53 | Platform Platform { get; set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Gets or sets whether to skip the standard wixlib. | ||
57 | /// </summary> | ||
58 | bool SkipStdWixlib { get; set; } | ||
59 | |||
60 | /// <summary> | ||
51 | /// Symbol definition creator used to load extension data. | 61 | /// Symbol definition creator used to load extension data. |
52 | /// </summary> | 62 | /// </summary> |
53 | ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } | 63 | ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } |
diff --git a/src/ext/UI/wixlib/WixUI_Minimal.wxs b/src/ext/UI/wixlib/WixUI_Minimal.wxs index e6f3437a..80a011e6 100644 --- a/src/ext/UI/wixlib/WixUI_Minimal.wxs +++ b/src/ext/UI/wixlib/WixUI_Minimal.wxs | |||
@@ -59,7 +59,6 @@ Patch dialog sequence: | |||
59 | 59 | ||
60 | <InstallUISequence> | 60 | <InstallUISequence> |
61 | <Show Dialog="override WelcomeDlg" Before="WelcomeEulaDlg" Condition="Installed AND PATCH" /> | 61 | <Show Dialog="override WelcomeDlg" Before="WelcomeEulaDlg" Condition="Installed AND PATCH" /> |
62 | <Show Dialog="override WelcomeEulaDlg" Before="ProgressDlg" Condition="NOT Installed" /> | ||
63 | </InstallUISequence> | 62 | </InstallUISequence> |
64 | 63 | ||
65 | <Property Id="ARPNOMODIFY" Value="1" /> | 64 | <Property Id="ARPNOMODIFY" Value="1" /> |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs index 234cad4a..5c2c40d1 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs | |||
@@ -550,11 +550,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
550 | } | 550 | } |
551 | else | 551 | else |
552 | { | 552 | { |
553 | foreach (var standardDirectory in WindowsInstallerStandard.StandardDirectories()) | 553 | foreach (var standardDirectoryId in WindowsInstallerStandard.StandardDirectoryIds()) |
554 | { | 554 | { |
555 | if (directoryId.StartsWith(standardDirectory.Id.Id, StringComparison.Ordinal)) | 555 | if (directoryId.StartsWith(standardDirectoryId, StringComparison.Ordinal)) |
556 | { | 556 | { |
557 | this.Messaging.Write(WarningMessages.StandardDirectoryConflictInMergeModule(symbol.SourceLineNumbers, directoryId, standardDirectory.Id.Id)); | 557 | this.Messaging.Write(WarningMessages.StandardDirectoryConflictInMergeModule(symbol.SourceLineNumbers, directoryId, standardDirectoryId)); |
558 | } | 558 | } |
559 | } | 559 | } |
560 | } | 560 | } |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 9701f958..71e1b22b 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -2280,10 +2280,10 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
2280 | xDirectory = xDirectory.Parent; | 2280 | xDirectory = xDirectory.Parent; |
2281 | } | 2281 | } |
2282 | 2282 | ||
2283 | if (xDirectory?.Name.LocalName == "StandardDirectory" && WindowsInstallerStandard.TryGetStandardDirectory(xDirectory.Attribute("Id").Value, out var standardDirectory)) | 2283 | if (xDirectory?.Name.LocalName == "StandardDirectory" && WindowsInstallerStandard.TryGetStandardDirectoryName(xDirectory.Attribute("Id").Value, out var standardDirectoryName)) |
2284 | { | 2284 | { |
2285 | sourcePath.Insert(0, Path.DirectorySeparatorChar); | 2285 | sourcePath.Insert(0, Path.DirectorySeparatorChar); |
2286 | sourcePath.Insert(0, standardDirectory.Name); | 2286 | sourcePath.Insert(0, standardDirectoryName); |
2287 | } | 2287 | } |
2288 | 2288 | ||
2289 | return sourcePath.ToString(); | 2289 | return sourcePath.ToString(); |
diff --git a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs index 2ad18073..b0cd174a 100644 --- a/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/wix/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -61,6 +61,7 @@ namespace WixToolset.Core.CommandLine | |||
61 | new CommandLineHelpSwitch("-loc", "Localization file to use in the build. By default, .wxl files are recognized as localization."), | 61 | new CommandLineHelpSwitch("-loc", "Localization file to use in the build. By default, .wxl files are recognized as localization."), |
62 | new CommandLineHelpSwitch("-lib", "Library file to use in the build. By default, .wixlib files are recognized as libraries."), | 62 | new CommandLineHelpSwitch("-lib", "Library file to use in the build. By default, .wixlib files are recognized as libraries."), |
63 | new CommandLineHelpSwitch("-src", "Source file to use in the build. By default, .wxs files are recognized as source code."), | 63 | new CommandLineHelpSwitch("-src", "Source file to use in the build. By default, .wxs files are recognized as source code."), |
64 | new CommandLineHelpSwitch("-nostdlib", "Skip use of WiX standard wixlib."), | ||
64 | new CommandLineHelpSwitch("-out", "-o", "Path to output the build to."), | 65 | new CommandLineHelpSwitch("-out", "-o", "Path to output the build to."), |
65 | new CommandLineHelpSwitch("-outputtype", "Explicitly set the output type if it cannot be determined from the output."), | 66 | new CommandLineHelpSwitch("-outputtype", "Explicitly set the output type if it cannot be determined from the output."), |
66 | new CommandLineHelpSwitch("-pdb", "Optional path to output .wixpdb. Default will write .wixpdb beside output path."), | 67 | new CommandLineHelpSwitch("-pdb", "Optional path to output .wixpdb. Default will write .wixpdb beside output path."), |
@@ -278,6 +279,8 @@ namespace WixToolset.Core.CommandLine | |||
278 | context.IntermediateFolder = this.IntermediateFolder; | 279 | context.IntermediateFolder = this.IntermediateFolder; |
279 | context.Intermediates = intermediates.Concat(libraries).ToList(); | 280 | context.Intermediates = intermediates.Concat(libraries).ToList(); |
280 | context.OutputPath = this.OutputPath; | 281 | context.OutputPath = this.OutputPath; |
282 | context.Platform = this.Platform; | ||
283 | context.SkipStdWixlib = this.commandLine.SkipStdWixlib; | ||
281 | context.SymbolDefinitionCreator = creator; | 284 | context.SymbolDefinitionCreator = creator; |
282 | context.CancellationToken = cancellationToken; | 285 | context.CancellationToken = cancellationToken; |
283 | 286 | ||
@@ -530,6 +533,8 @@ namespace WixToolset.Core.CommandLine | |||
530 | 533 | ||
531 | public string TrackingFile { get; private set; } | 534 | public string TrackingFile { get; private set; } |
532 | 535 | ||
536 | public bool SkipStdWixlib { get; set; } | ||
537 | |||
533 | public bool ResetAcls { get; set; } | 538 | public bool ResetAcls { get; set; } |
534 | 539 | ||
535 | public CommandLine(IServiceProvider serviceProvider, IMessaging messaging) | 540 | public CommandLine(IServiceProvider serviceProvider, IMessaging messaging) |
@@ -685,6 +690,10 @@ namespace WixToolset.Core.CommandLine | |||
685 | parser.GetNextArgumentAsFilePathOrError(arg, "source code", this.SourceFilePaths); | 690 | parser.GetNextArgumentAsFilePathOrError(arg, "source code", this.SourceFilePaths); |
686 | return true; | 691 | return true; |
687 | 692 | ||
693 | case "nostdlib": | ||
694 | this.SkipStdWixlib = true; | ||
695 | return true; | ||
696 | |||
688 | case "o": | 697 | case "o": |
689 | case "out": | 698 | case "out": |
690 | this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg, "output file"); | 699 | this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg, "output file"); |
diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 73fd494d..6a01b0ef 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs | |||
@@ -7129,7 +7129,7 @@ namespace WixToolset.Core | |||
7129 | } | 7129 | } |
7130 | else if (!WindowsInstallerStandard.IsStandardDirectory(id)) | 7130 | else if (!WindowsInstallerStandard.IsStandardDirectory(id)) |
7131 | { | 7131 | { |
7132 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Id", id, String.Join(", \"", WindowsInstallerStandard.StandardDirectories().Select(d => d.Id.Id)))); | 7132 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Id", id, String.Join(", \"", WindowsInstallerStandard.StandardDirectoryIds()))); |
7133 | } | 7133 | } |
7134 | 7134 | ||
7135 | foreach (var child in node.Elements()) | 7135 | foreach (var child in node.Elements()) |
diff --git a/src/wix/WixToolset.Core/Compiler_Module.cs b/src/wix/WixToolset.Core/Compiler_Module.cs index 0a547ad7..092f3473 100644 --- a/src/wix/WixToolset.Core/Compiler_Module.cs +++ b/src/wix/WixToolset.Core/Compiler_Module.cs | |||
@@ -285,6 +285,8 @@ namespace WixToolset.Core | |||
285 | } | 285 | } |
286 | 286 | ||
287 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, this.activeLanguage); | 287 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, this.activeLanguage); |
288 | |||
289 | this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixFragment, WixStandardLibraryIdentifiers.WixStandardModuleReferences); | ||
288 | } | 290 | } |
289 | } | 291 | } |
290 | finally | 292 | finally |
diff --git a/src/wix/WixToolset.Core/Compiler_Package.cs b/src/wix/WixToolset.Core/Compiler_Package.cs index bfc59c75..02ed9092 100644 --- a/src/wix/WixToolset.Core/Compiler_Package.cs +++ b/src/wix/WixToolset.Core/Compiler_Package.cs | |||
@@ -423,6 +423,8 @@ namespace WixToolset.Core | |||
423 | SymbolPaths = symbols, | 423 | SymbolPaths = symbols, |
424 | }); | 424 | }); |
425 | } | 425 | } |
426 | |||
427 | this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixFragment, WixStandardLibraryIdentifiers.WixStandardPackageReferences); | ||
426 | } | 428 | } |
427 | } | 429 | } |
428 | finally | 430 | finally |
diff --git a/src/wix/WixToolset.Core/Link/AddRequiredStandardDirectories.cs b/src/wix/WixToolset.Core/Link/AddRequiredStandardDirectories.cs deleted file mode 100644 index 38493648..00000000 --- a/src/wix/WixToolset.Core/Link/AddRequiredStandardDirectories.cs +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
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.Link | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using System.Linq; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Data.Symbols; | ||
10 | using WixToolset.Data.WindowsInstaller; | ||
11 | |||
12 | /// <summary> | ||
13 | /// Add referenced standard directory symbols, if not already present. | ||
14 | /// </summary> | ||
15 | internal class AddRequiredStandardDirectories | ||
16 | { | ||
17 | public AddRequiredStandardDirectories(IntermediateSection section, List<WixSimpleReferenceSymbol> references) | ||
18 | { | ||
19 | this.Section = section; | ||
20 | this.References = references; | ||
21 | } | ||
22 | |||
23 | private IntermediateSection Section { get; } | ||
24 | |||
25 | private List<WixSimpleReferenceSymbol> References { get; } | ||
26 | |||
27 | public void Execute() | ||
28 | { | ||
29 | var platform = this.GetPlatformFromSection(); | ||
30 | |||
31 | var directories = this.Section.Symbols.OfType<DirectorySymbol>().ToList(); | ||
32 | var directoryIds = new SortedSet<string>(directories.Select(d => d.Id.Id)); | ||
33 | |||
34 | // Ensure any standard directory references symbols are added. | ||
35 | foreach (var directoryReference in this.References.Where(r => r.Table == "Directory")) | ||
36 | { | ||
37 | this.EnsureStandardDirectoryAdded(directoryIds, directoryReference.PrimaryKeys, directoryReference.SourceLineNumbers, platform); | ||
38 | } | ||
39 | |||
40 | foreach (var directory in directories) | ||
41 | { | ||
42 | var parentDirectoryId = directory.ParentDirectoryRef; | ||
43 | |||
44 | if (String.IsNullOrEmpty(parentDirectoryId)) | ||
45 | { | ||
46 | parentDirectoryId = this.GetStandardDirectoryParent(directory.Id.Id, platform); | ||
47 | |||
48 | directory.ParentDirectoryRef = parentDirectoryId; | ||
49 | |||
50 | //if (directory.Id.Id != "TARGETDIR") | ||
51 | //{ | ||
52 | // directory.ParentDirectoryRef = "TARGETDIR"; | ||
53 | //} | ||
54 | } | ||
55 | |||
56 | if (!String.IsNullOrEmpty(parentDirectoryId)) | ||
57 | { | ||
58 | this.EnsureStandardDirectoryAdded(directoryIds, parentDirectoryId, directory.SourceLineNumbers, platform); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | if (!directoryIds.Contains("TARGETDIR") && WindowsInstallerStandard.TryGetStandardDirectory("TARGETDIR", out var targetDir)) | ||
63 | { | ||
64 | directoryIds.Add(targetDir.Id.Id); | ||
65 | this.Section.AddSymbol(targetDir); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | private void EnsureStandardDirectoryAdded(ISet<string> directoryIds, string directoryId, SourceLineNumber sourceLineNumbers, Platform platform) | ||
70 | { | ||
71 | if (!directoryIds.Contains(directoryId) && WindowsInstallerStandard.TryGetStandardDirectory(directoryId, out var standardDirectory)) | ||
72 | { | ||
73 | var parentDirectoryId = this.GetStandardDirectoryParent(directoryId, platform); | ||
74 | |||
75 | var directory = new DirectorySymbol(sourceLineNumbers, standardDirectory.Id) | ||
76 | { | ||
77 | Name = standardDirectory.Name, | ||
78 | ParentDirectoryRef = parentDirectoryId, | ||
79 | }; | ||
80 | |||
81 | directoryIds.Add(directory.Id.Id); | ||
82 | this.Section.AddSymbol(directory); | ||
83 | |||
84 | if (!String.IsNullOrEmpty(parentDirectoryId)) | ||
85 | { | ||
86 | this.EnsureStandardDirectoryAdded(directoryIds, parentDirectoryId, sourceLineNumbers, platform); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | private string GetStandardDirectoryParent(string directoryId, Platform platform) | ||
92 | { | ||
93 | switch (directoryId) | ||
94 | { | ||
95 | case "TARGETDIR": | ||
96 | return null; | ||
97 | |||
98 | case "CommonFiles6432Folder": | ||
99 | case "ProgramFiles6432Folder": | ||
100 | case "System6432Folder": | ||
101 | return WindowsInstallerStandard.GetPlatformSpecificDirectoryId(directoryId, platform); | ||
102 | |||
103 | default: | ||
104 | return "TARGETDIR"; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | private Platform GetPlatformFromSection() | ||
109 | { | ||
110 | var symbol = this.Section.Symbols.OfType<SummaryInformationSymbol>().First(p => p.PropertyId == SummaryInformationType.PlatformAndLanguage); | ||
111 | |||
112 | var value = symbol.Value; | ||
113 | var separatorIndex = value.IndexOf(';'); | ||
114 | var platformValue = separatorIndex > 0 ? value.Substring(0, separatorIndex) : value; | ||
115 | |||
116 | switch (platformValue) | ||
117 | { | ||
118 | case "x64": | ||
119 | return Platform.X64; | ||
120 | |||
121 | case "Arm64": | ||
122 | return Platform.ARM64; | ||
123 | |||
124 | case "Intel": | ||
125 | default: | ||
126 | return Platform.X86; | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | } | ||
diff --git a/src/wix/WixToolset.Core/LinkContext.cs b/src/wix/WixToolset.Core/LinkContext.cs index 10223171..dd004817 100644 --- a/src/wix/WixToolset.Core/LinkContext.cs +++ b/src/wix/WixToolset.Core/LinkContext.cs | |||
@@ -30,6 +30,10 @@ namespace WixToolset.Core | |||
30 | 30 | ||
31 | public string OutputPath { get; set; } | 31 | public string OutputPath { get; set; } |
32 | 32 | ||
33 | public Platform Platform { get; set; } | ||
34 | |||
35 | public bool SkipStdWixlib { get; set; } | ||
36 | |||
33 | public ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } | 37 | public ISymbolDefinitionCreator SymbolDefinitionCreator { get; set; } |
34 | 38 | ||
35 | public CancellationToken CancellationToken { get; set; } | 39 | public CancellationToken CancellationToken { get; set; } |
diff --git a/src/wix/WixToolset.Core/Linker.cs b/src/wix/WixToolset.Core/Linker.cs index 85333da4..0cef88d2 100644 --- a/src/wix/WixToolset.Core/Linker.cs +++ b/src/wix/WixToolset.Core/Linker.cs | |||
@@ -11,7 +11,6 @@ namespace WixToolset.Core | |||
11 | using WixToolset.Core.Link; | 11 | using WixToolset.Core.Link; |
12 | using WixToolset.Data; | 12 | using WixToolset.Data; |
13 | using WixToolset.Data.Symbols; | 13 | using WixToolset.Data.Symbols; |
14 | using WixToolset.Data.WindowsInstaller; | ||
15 | using WixToolset.Extensibility.Data; | 14 | using WixToolset.Extensibility.Data; |
16 | using WixToolset.Extensibility.Services; | 15 | using WixToolset.Extensibility.Services; |
17 | 16 | ||
@@ -98,8 +97,13 @@ namespace WixToolset.Core | |||
98 | } | 97 | } |
99 | } | 98 | } |
100 | 99 | ||
101 | // TODO: Replace this with "std.wixlib" | 100 | // Load the standard wixlib. |
102 | this.LoadStandardSymbols(sections); | 101 | if (!this.Context.SkipStdWixlib) |
102 | { | ||
103 | var stdlib = WixStandardLibrary.Build(this.Context.Platform); | ||
104 | |||
105 | sections.AddRange(stdlib.Sections); | ||
106 | } | ||
103 | 107 | ||
104 | var multipleFeatureComponents = new Hashtable(); | 108 | var multipleFeatureComponents = new Hashtable(); |
105 | 109 | ||
@@ -122,9 +126,6 @@ namespace WixToolset.Core | |||
122 | } | 126 | } |
123 | } | 127 | } |
124 | 128 | ||
125 | ////// Add the missing standard action and directory symbols. | ||
126 | ////this.LoadStandardSymbols(find.SymbolsByName); | ||
127 | |||
128 | // Resolve the symbol references to find the set of sections we care about for linking. | 129 | // Resolve the symbol references to find the set of sections we care about for linking. |
129 | // Of course, we start with the entry section (that's how it got its name after all). | 130 | // Of course, we start with the entry section (that's how it got its name after all). |
130 | var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.SymbolsByName); | 131 | var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.SymbolsByName); |
@@ -187,7 +188,6 @@ namespace WixToolset.Core | |||
187 | // Create a new section to hold the linked content. Start with the entry section's | 188 | // Create a new section to hold the linked content. Start with the entry section's |
188 | // metadata. | 189 | // metadata. |
189 | var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type); | 190 | var resolvedSection = new IntermediateSection(find.EntrySection.Id, find.EntrySection.Type); |
190 | var references = new List<WixSimpleReferenceSymbol>(); | ||
191 | var identicalDirectoryIds = new HashSet<string>(StringComparer.Ordinal); | 191 | var identicalDirectoryIds = new HashSet<string>(StringComparer.Ordinal); |
192 | 192 | ||
193 | foreach (var section in sections) | 193 | foreach (var section in sections) |
@@ -263,13 +263,9 @@ namespace WixToolset.Core | |||
263 | } | 263 | } |
264 | break; | 264 | break; |
265 | 265 | ||
266 | case SymbolDefinitionType.WixComplexReference: | ||
267 | copySymbol = false; | ||
268 | break; | ||
269 | |||
270 | case SymbolDefinitionType.WixSimpleReference: | 266 | case SymbolDefinitionType.WixSimpleReference: |
267 | case SymbolDefinitionType.WixComplexReference: | ||
271 | copySymbol = false; | 268 | copySymbol = false; |
272 | references.Add(symbol as WixSimpleReferenceSymbol); | ||
273 | break; | 269 | break; |
274 | 270 | ||
275 | case SymbolDefinitionType.WixVariable: | 271 | case SymbolDefinitionType.WixVariable: |
@@ -310,12 +306,6 @@ namespace WixToolset.Core | |||
310 | var command = new FlattenAndProcessBundleTablesCommand(resolvedSection, this.Messaging); | 306 | var command = new FlattenAndProcessBundleTablesCommand(resolvedSection, this.Messaging); |
311 | command.Execute(); | 307 | command.Execute(); |
312 | } | 308 | } |
313 | else if (resolvedSection.Type == SectionType.Package || resolvedSection.Type == SectionType.Module) | ||
314 | { | ||
315 | // Packages and modules get standard directories add. | ||
316 | var command = new AddRequiredStandardDirectories(resolvedSection, references); | ||
317 | command.Execute(); | ||
318 | } | ||
319 | 309 | ||
320 | if (this.Messaging.EncounteredError) | 310 | if (this.Messaging.EncounteredError) |
321 | { | 311 | { |
@@ -365,66 +355,6 @@ namespace WixToolset.Core | |||
365 | } | 355 | } |
366 | 356 | ||
367 | /// <summary> | 357 | /// <summary> |
368 | /// Load the standard action and directory symbols. | ||
369 | /// </summary> | ||
370 | /// <param name="symbolsByName">Collection of symbols.</param> | ||
371 | //private void LoadStandardSymbols(IDictionary<string, SymbolWithSection> symbolsByName) | ||
372 | //{ | ||
373 | // foreach (var actionSymbol in WindowsInstallerStandard.StandardActions()) | ||
374 | // { | ||
375 | // var symbolWithSection = new SymbolWithSection(null, actionSymbol); | ||
376 | // var fullName = symbolWithSection.GetFullName(); | ||
377 | |||
378 | // // If the action's symbol has not already been defined (i.e. overriden by the user), add it now. | ||
379 | // if (!symbolsByName.ContainsKey(fullName)) | ||
380 | // { | ||
381 | // symbolsByName.Add(fullName, symbolWithSection); | ||
382 | // } | ||
383 | // } | ||
384 | |||
385 | // foreach (var directorySymbol in WindowsInstallerStandard.StandardDirectories()) | ||
386 | // { | ||
387 | // var symbolWithSection = new SymbolWithSection(null, directorySymbol); | ||
388 | // var fullName = symbolWithSection.GetFullName(); | ||
389 | |||
390 | // // If the directory's symbol has not already been defined (i.e. overriden by the user), add it now. | ||
391 | // if (!symbolsByName.ContainsKey(fullName)) | ||
392 | // { | ||
393 | // symbolsByName.Add(fullName, symbolWithSection); | ||
394 | // } | ||
395 | // } | ||
396 | //} | ||
397 | |||
398 | private void LoadStandardSymbols(List<IntermediateSection> sections) | ||
399 | { | ||
400 | foreach (var actionSymbol in WindowsInstallerStandard.StandardActions()) | ||
401 | { | ||
402 | var section = new IntermediateSection(actionSymbol.Id.Id, SectionType.Fragment); | ||
403 | section.AddSymbol(new WixActionSymbol(null, new Identifier(actionSymbol.Id.Access, actionSymbol.Id.Id)) | ||
404 | { | ||
405 | Action = actionSymbol.Action, | ||
406 | SequenceTable = actionSymbol.SequenceTable, | ||
407 | Sequence = actionSymbol.Sequence, | ||
408 | Condition = actionSymbol.Condition, | ||
409 | }); | ||
410 | |||
411 | sections.Add(section); | ||
412 | } | ||
413 | |||
414 | foreach (var directorySymbol in WindowsInstallerStandard.StandardDirectories()) | ||
415 | { | ||
416 | var section = new IntermediateSection(directorySymbol.Id.Id, SectionType.Fragment); | ||
417 | section.AddSymbol(new DirectorySymbol(null, new Identifier(directorySymbol.Id.Access, directorySymbol.Id.Id)) | ||
418 | { | ||
419 | Name = directorySymbol.Name | ||
420 | }); | ||
421 | |||
422 | sections.Add(section); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | |||
427 | /// <summary> | ||
428 | /// Process the complex references. | 358 | /// Process the complex references. |
429 | /// </summary> | 359 | /// </summary> |
430 | /// <param name="resolvedSection">Active section to add symbols to.</param> | 360 | /// <param name="resolvedSection">Active section to add symbols to.</param> |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs index 3667a2f2..e42c7810 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs | |||
@@ -35,6 +35,7 @@ namespace WixToolsetTest.CoreIntegration | |||
35 | context.IntermediateFolder = Path.GetTempPath(); | 35 | context.IntermediateFolder = Path.GetTempPath(); |
36 | context.Intermediates = new[] { intermediate1, intermediate2 }; | 36 | context.Intermediates = new[] { intermediate1, intermediate2 }; |
37 | context.OutputPath = Path.Combine(context.IntermediateFolder, "test.msi"); | 37 | context.OutputPath = Path.Combine(context.IntermediateFolder, "test.msi"); |
38 | context.Platform = Platform.X64; | ||
38 | context.SymbolDefinitionCreator = creator; | 39 | context.SymbolDefinitionCreator = creator; |
39 | 40 | ||
40 | var linker = serviceProvider.GetService<ILinker>(); | 41 | var linker = serviceProvider.GetService<ILinker>(); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs index 7de55810..bcbdb00f 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Variables/Package.wxs | |||
@@ -1,4 +1,4 @@ | |||
1 | <?define Foo = "Foo" ?> | 1 | <?define Foo = "Foo" ?> |
2 | <?define Foo = "Foo" ?> | 2 | <?define Foo = "Foo" ?> |
3 | 3 | ||
4 | <?define Bar = "Bar" ?> | 4 | <?define Bar = "Bar" ?> |
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 13 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
14 | <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" Compressed="no" InstallerVersion="200" Scope="perMachine"> | 14 | <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" Compressed="no" InstallerVersion="200" Scope="perMachine"> |
15 | |||
16 | 15 | ||
17 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | 16 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> |
18 | 17 | ||
@@ -22,8 +21,8 @@ | |||
22 | </Package> | 21 | </Package> |
23 | 22 | ||
24 | <Fragment> | 23 | <Fragment> |
25 | <Directory Id="TARGETDIR" Name="SourceDir"> | 24 | <Directory Id="override TARGETDIR" Name="SourceDir"> |
26 | <Directory Id="ProgramFilesFolder"> | 25 | <Directory Id="override ProgramFilesFolder"> |
27 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | 26 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> |
28 | </Directory> | 27 | </Directory> |
29 | </Directory> | 28 | </Directory> |