Skip to content

Commit b5ad0ac

Browse files
committed
exclude analyzed project from unreferenced projects
1 parent cb1c169 commit b5ad0ac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

DeadProjectFinder/Program.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ private static void DoWork(string projectPath, string rootPath, bool reportAllTo
167167
var projectFiles = GetRecursiveFiles("*.csproj")
168168
.Concat(GetRecursiveFiles("*.vcxproj"))
169169
.Concat(GetRecursiveFiles("*.bproj"));
170-
var unreferencedProjectFiles = projectFiles.Except(_globalReferenceCount.Keys, StringComparer.OrdinalIgnoreCase).ToList();
170+
var unreferencedProjectFiles = projectFiles
171+
// all project files except those we found references to
172+
.Except(_globalReferenceCount.Keys
173+
// don't include the analyzed project as unreferenced
174+
.Append(Path.GetRelativePath(rootPath, projectPath)),
175+
StringComparer.OrdinalIgnoreCase).ToList();
171176
Console.WriteLine($"{unreferencedProjectFiles.Count} unreferenced project files found:");
172177
foreach (var unrootedPath in unreferencedProjectFiles.OrderBy(path => path))
173178
{

0 commit comments

Comments
 (0)