aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-11-20 14:59:57 -0800
committerRob Mensching <rob@firegiant.com>2022-11-21 09:12:41 -0800
commite6ef75f3616f1221a43e3b412b42f9ca6a2bef7e (patch)
tree91dd483c78c24b96bde4026ed9772357b25cb882
parent6ed066072db5bf15453da1f8da28f727ba46fc5b (diff)
downloadwix-e6ef75f3616f1221a43e3b412b42f9ca6a2bef7e.tar.gz
wix-e6ef75f3616f1221a43e3b412b42f9ca6a2bef7e.tar.bz2
wix-e6ef75f3616f1221a43e3b412b42f9ca6a2bef7e.zip
Log error when path to executable cannot be found in MSBuild tool task
This is additional logging to try to track down the root cause of 7035.
-rw-r--r--src/internal/WixInternal.BaseBuildTasks.Sources/BaseToolsetTask.cs47
-rw-r--r--src/wix/WixToolset.BuildTasks/ReadTracking.cs2
2 files changed, 36 insertions, 13 deletions
diff --git a/src/internal/WixInternal.BaseBuildTasks.Sources/BaseToolsetTask.cs b/src/internal/WixInternal.BaseBuildTasks.Sources/BaseToolsetTask.cs
index d9e3b5e8..6edd4a35 100644
--- a/src/internal/WixInternal.BaseBuildTasks.Sources/BaseToolsetTask.cs
+++ b/src/internal/WixInternal.BaseBuildTasks.Sources/BaseToolsetTask.cs
@@ -3,6 +3,7 @@
3namespace WixToolset.BaseBuildTasks 3namespace WixToolset.BaseBuildTasks
4{ 4{
5 using System; 5 using System;
6 using System.Collections.Generic;
6 using System.IO; 7 using System.IO;
7 using System.Runtime.InteropServices; 8 using System.Runtime.InteropServices;
8 using Microsoft.Build.Utilities; 9 using Microsoft.Build.Utilities;
@@ -129,24 +130,48 @@ namespace WixToolset.BaseBuildTasks
129 return false; 130 return false;
130 } 131 }
131#else 132#else
132 private static string GetArchitectureFolder(string baseFolder) 133 private string FindArchitectureSpecificToolPath(string baseFolder)
133 { 134 {
135 var checkedPaths = new List<string>();
136
134 // First try to find a folder that matches this task's architecture. 137 // First try to find a folder that matches this task's architecture.
135 var folder = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); 138 var archFolder = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant();
139
140 var path = Path.Combine(baseFolder, archFolder, this.ToolExe);
141
142 if (File.Exists(path))
143 {
144 return path;
145 }
146
147 checkedPaths.Add(path);
136 148
137 if (Directory.Exists(Path.Combine(baseFolder, folder))) 149 // Try to fallback to "x86" folder since it tends to run on all architectures.
150 if (!String.Equals(archFolder, "x86", StringComparison.OrdinalIgnoreCase))
138 { 151 {
139 return folder; 152 path = Path.Combine(baseFolder, "x86", this.ToolExe);
153
154 if (File.Exists(path))
155 {
156 return path;
157 }
158
159 checkedPaths.Add(path);
140 } 160 }
141 161
142 // Try to fallback to "x86" folder. 162 // Return empty, even though this isn't likely to be there.
143 if (folder != "x86" && Directory.Exists(Path.Combine(baseFolder, "x86"))) 163 path = Path.Combine(baseFolder, this.ToolExe);
164
165 if (File.Exists(path))
144 { 166 {
145 return "x86"; 167 return path;
146 } 168 }
147 169
148 // Return empty, even though this isn't likely to be useful. 170 checkedPaths.Add(path);
149 return String.Empty; 171
172 this.Log.LogError("Cannot find tool executable {0} at any of the checked paths: {1}. This is unexpected and will cause later commands to fail.", this.ToolExe, String.Join(", ", checkedPaths));
173
174 return path;
150 } 175 }
151#endif 176#endif
152 177
@@ -159,9 +184,7 @@ namespace WixToolset.BaseBuildTasks
159#else 184#else
160 var thisTaskFolder = Path.GetDirectoryName(new Uri(typeof(BaseToolsetTask).Assembly.CodeBase).AbsolutePath); 185 var thisTaskFolder = Path.GetDirectoryName(new Uri(typeof(BaseToolsetTask).Assembly.CodeBase).AbsolutePath);
161 186
162 var archFolder = GetArchitectureFolder(thisTaskFolder); 187 return this.FindArchitectureSpecificToolPath(thisTaskFolder);
163
164 return Path.Combine(thisTaskFolder, archFolder, this.ToolExe);
165#endif 188#endif
166 } 189 }
167 190
diff --git a/src/wix/WixToolset.BuildTasks/ReadTracking.cs b/src/wix/WixToolset.BuildTasks/ReadTracking.cs
index f92baaf1..25215956 100644
--- a/src/wix/WixToolset.BuildTasks/ReadTracking.cs
+++ b/src/wix/WixToolset.BuildTasks/ReadTracking.cs
@@ -93,7 +93,7 @@ namespace WixToolset.BuildTasks
93 } 93 }
94 else 94 else
95 { 95 {
96 this.Log.LogError($"Failed to parse tracked line: {line}"); 96 this.Log.LogError("Failed to parse tracked line: {0}", line);
97 } 97 }
98 } 98 }
99 } 99 }