Skip to content

Commit 29e4fa3

Browse files
committed
C# autobuilder: Build all solutions at the highest depth
The most common reason for the C# autobuilder to fail is because it cannot determine a single unique .sln or .proj file to build, instead reporting multiple sln or proj files at the same shortest depth. This commit changes this to build all such files, rather than reporting an error.
1 parent 1bd0c69 commit 29e4fa3

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

csharp/autobuilder/Semmle.Autobuild/Autobuilder.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,9 @@ IEnumerable<IProjectOrSolution> FindFiles(string extension, Func<string, Project
156156
if (options.AllSolutions)
157157
return matchingFiles.Select(p => p.ProjectOrSolution);
158158

159-
var firstIsClosest = matchingFiles.Length > 1 && matchingFiles[0].DistanceFromRoot < matchingFiles[1].DistanceFromRoot;
160-
if (matchingFiles.Length == 1 || firstIsClosest)
161-
return matchingFiles.Select(p => p.ProjectOrSolution).Take(1);
162-
163-
var candidates = matchingFiles.
159+
return matchingFiles.
164160
Where(f => f.DistanceFromRoot == matchingFiles[0].DistanceFromRoot).
165161
Select(f => f.ProjectOrSolution);
166-
Log(Severity.Info, $"Found multiple '{extension}' files, giving up: {string.Join(", ", candidates)}.");
167-
return new IProjectOrSolution[0];
168162
}
169163

170164
// First look for `.proj` files

0 commit comments

Comments
 (0)