diff options
| author | Rob Mensching <rob@firegiant.com> | 2022-10-14 09:34:30 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2022-10-14 20:13:50 -0700 |
| commit | 08f53f409020b12dffaa2aeefa943b667a4b9328 (patch) | |
| tree | 42bad414ff06c19fb881c7db1b145ec1d6885521 /src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs | |
| parent | 07b3d459ea0a45cbef29b98d283edafbab26462a (diff) | |
| download | wix-08f53f409020b12dffaa2aeefa943b667a4b9328.tar.gz wix-08f53f409020b12dffaa2aeefa943b667a4b9328.tar.bz2 wix-08f53f409020b12dffaa2aeefa943b667a4b9328.zip | |
Simplify reference resolution
WiX v3 extension loading had options that were rarely if ever used
and library paths modeled after C++. Given the new Sdk-style model
in WiX v4, we can simplify reference resolution.
Fixes 6945, 6946
Diffstat (limited to 'src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs')
| -rw-r--r-- | src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs b/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs index 152992dd..d950bca9 100644 --- a/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs +++ b/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs | |||
| @@ -76,79 +76,6 @@ namespace WixToolset.BaseBuildTasks | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | /// <summary> | 78 | /// <summary> |
| 79 | /// Build the extensions argument. Each extension is searched in the current folder, user defined search | ||
| 80 | /// directories (ReferencePath), HintPath, and under Wix Extension Directory in that order. | ||
| 81 | /// The order of precedence is based off of that described in Microsoft.Common.Targets's SearchPaths | ||
| 82 | /// property for the ResolveAssemblyReferences task. | ||
| 83 | /// </summary> | ||
| 84 | /// <param name="extensions">The list of extensions to include.</param> | ||
| 85 | /// <param name="wixExtensionDirectory">Evaluated default folder for Wix Extensions</param> | ||
| 86 | /// <param name="referencePaths">User defined reference directories to search in</param> | ||
| 87 | public void AppendExtensions(ITaskItem[] extensions, string wixExtensionDirectory, string [] referencePaths) | ||
| 88 | { | ||
| 89 | if (extensions == null) | ||
| 90 | { | ||
| 91 | return; | ||
| 92 | } | ||
| 93 | |||
| 94 | foreach (ITaskItem extension in extensions) | ||
| 95 | { | ||
| 96 | string className = extension.GetMetadata("Class"); | ||
| 97 | |||
| 98 | string fileName = Path.GetFileName(extension.ItemSpec); | ||
| 99 | |||
| 100 | if (String.IsNullOrEmpty(Path.GetExtension(fileName))) | ||
| 101 | { | ||
| 102 | fileName += ".dll"; | ||
| 103 | } | ||
| 104 | |||
| 105 | // First try reference paths | ||
| 106 | var resolvedPath = FileSearchHelperMethods.SearchFilePaths(referencePaths, fileName); | ||
| 107 | |||
| 108 | if (String.IsNullOrEmpty(resolvedPath)) | ||
| 109 | { | ||
| 110 | // Now try HintPath | ||
| 111 | resolvedPath = extension.GetMetadata("HintPath"); | ||
| 112 | |||
| 113 | if (!File.Exists(resolvedPath)) | ||
| 114 | { | ||
| 115 | // Now try the item itself | ||
| 116 | resolvedPath = extension.ItemSpec; | ||
| 117 | |||
| 118 | if (String.IsNullOrEmpty(Path.GetExtension(resolvedPath))) | ||
| 119 | { | ||
| 120 | resolvedPath += ".dll"; | ||
| 121 | } | ||
| 122 | |||
| 123 | if (!File.Exists(resolvedPath)) | ||
| 124 | { | ||
| 125 | if (!String.IsNullOrEmpty(wixExtensionDirectory)) | ||
| 126 | { | ||
| 127 | // Now try the extension directory | ||
| 128 | resolvedPath = Path.Combine(wixExtensionDirectory, Path.GetFileName(resolvedPath)); | ||
| 129 | } | ||
| 130 | |||
| 131 | if (!File.Exists(resolvedPath)) | ||
| 132 | { | ||
| 133 | // Extension wasn't found, just set it to the extension name passed in | ||
| 134 | resolvedPath = extension.ItemSpec; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | if (String.IsNullOrEmpty(className)) | ||
| 141 | { | ||
| 142 | this.AppendSwitchIfNotNull("-ext ", resolvedPath); | ||
| 143 | } | ||
| 144 | else | ||
| 145 | { | ||
| 146 | this.AppendSwitchIfNotNull("-ext ", className + ", " + resolvedPath); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | } | ||
| 150 | |||
| 151 | /// <summary> | ||
| 152 | /// Append arbitrary text to the command-line if specified. | 79 | /// Append arbitrary text to the command-line if specified. |
| 153 | /// </summary> | 80 | /// </summary> |
| 154 | /// <param name="textToAppend">Text to append.</param> | 81 | /// <param name="textToAppend">Text to append.</param> |
