{"record":{"id":"04848cd8e0510d38","repo":"dotnet/BenchmarkDotNet","slug":"unable-to-find-projectname-in-rootdirectory-ful","errorCode":null,"errorMessage":"Unable to find {projectName} in {rootDirectory.FullName} and its subfolders. Most probably the name of output exe is different than the name of the .(c/f)sproj","messagePattern":"Unable to find (.+?) in (.+?) and its subfolders\\. Most probably the name of output exe is different than the name of the \\.\\(c/f\\)sproj","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs","lineNumber":435,"sourceCode":"        private static bool ShouldIgnoreDirectory(DirectoryInfo directory)\n            => IgnoredDirectoryNames.Contains(directory.Name)\n            || directory.Name.StartsWith(\".\", StringComparison.Ordinal)\n#if NETSTANDARD2_0\n            || directory.Attributes.HasFlag(FileAttributes.Hidden)\n            || directory.Attributes.HasFlag(FileAttributes.ReparsePoint)\n#endif\n            ;\n\n        public static FileInfo FindProjectFile(DirectoryInfo rootDirectory, string projectName)\n        {\n            var projectFiles = EnumerateProjectFiles(rootDirectory, projectName);\n\n            // Take first 2 items for performance reasons\n            var files = projectFiles.Take(2).ToArray();\n            return files.Length switch\n            {\n                1 => files[0],\n                0 => throw new NotSupportedException(\n                    $\"Unable to find {projectName} in {rootDirectory.FullName} and its subfolders. Most probably the name of output exe is different than the name of the .(c/f)sproj\"),\n                _ => throw new NotSupportedException(\n                    $\"Found more than one matching project file for {projectName} in {rootDirectory.FullName} and its subfolders: '{files[0].FullName}','{files[1].FullName}'. Benchmark project names needs to be unique.\"),\n            };\n        }\n\n        private static IEnumerable<FileInfo> EnumerateProjectFiles(DirectoryInfo rootDirectory, string projectName)\n        {\n            var stack = new Stack<DirectoryInfo>();\n            stack.Push(rootDirectory);\n\n            while (stack.Count > 0)\n            {\n                var currentDir = stack.Pop();\n\n                // 1. Search '*.proj' files in the current directory\n                IEnumerable<FileInfo> files = EnumerateProjectFiles(currentDir);\n","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs#L417-L453","documentation":"CsProjGenerator searches rootDirectory recursively for a project whose file name matches the expected benchmark output name; it fails when no matching .csproj/.fsproj exists.","triggerScenarios":"Thrown at src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs:435 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make sure the output assembly name matches the project file name (the .csproj/.fsproj), or pass the correct project name explicitly.","Check that the project file actually exists under the given root directory or one of its subfolders.","Use an absolute rootDirectory that contains the benchmark project."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}