{"record":{"id":"d3ef583dfbd9e2ac","repo":"Unity-Technologies/UnityCsReference","slug":"could-not-determine-which-of-the-candidates-lengt","errorCode":null,"errorMessage":"Could not determine which of the {candidates.Length} of {toolName} to use.  The expected TFM or expected directory layout may have changed and this logic may need to be updated","messagePattern":"Could not determine which of the (.+?) of (.+?) to use\\.  The expected TFM or expected directory layout may have changed and this logic may need to be updated","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs","lineNumber":619,"sourceCode":"                        return candidate.ToString();\n                    }\n\n                    // Examples :\n                    // 1)   il2cpp/bin/Release/<tfm>/<platform dir>/publish/il2cpp.exe\n                    // 2)   il2cpp/bin/Debug/<tfm>/<platform dir>/publish/il2cpp.exe\n                    if (candidate.Parent.FileName == \"publish\" && candidate.Parent.Parent.FileName == expectedPublishDirectoryName)\n                    {\n                        // found a published build\n                        return candidate.ToString();\n                    }\n\n                    // There is a 3rd path structure that we will ignore\n                    // Examples :\n                    // 1)   il2cpp/bin/Release/<tfm>/<platform dir>/il2cpp.exe\n                    // 2)   il2cpp/bin/Debug/<tfm>/<platform dir>/il2cpp.exe\n                }\n\n                throw new InvalidOperationException($\"Could not determine which of the {candidates.Length} of {toolName} to use.  The expected TFM or expected directory layout may have changed and this logic may need to be updated\");\n            }\n\n            var deployDirectory = $\"{il2CppFolder}/build/deploy\";\n            return $\"{deployDirectory}/{expectedToolExecutableName}\";\n        }\n\n        internal static string GetLibrarySearchPaths(string name, string tfm, string customRoot = null)\n        {\n            var il2CppFolder = GetIl2CppFolder(out var isDevelopmentLocation);\n            var expectedToolExecutableName = $\"{name}.dll\";\n\n            if (isDevelopmentLocation)\n            {\n                // Locating the correct development build to use is a little tricky.  Complications come from\n                // 1) We don't know if the Debug or Release build is desired.  To overcome this we will pick whichever was modified most recently\n\n                var topLevel = il2CppFolder;\n                if (customRoot != null)","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs#L601-L637","documentation":"Thrown after candidates for an IL2CPP tool were found, but none matched either the non-published layout (bin/<config>/<tfm>/exe) or the published layout (bin/<config>/<tfm>/publish/<platformDir>/exe). This means the on-disk directory structure changed and the heuristic cannot pick a binary.","triggerScenarios":"Dev IL2CPP location has built outputs but in an unrecognized TFM/publish layout; a toolchain layout refactor moved outputs into a third structure that this logic intentionally ignores.","commonSituations":"Upgrading the IL2CPP source tree to a version whose build output layout differs; a new TFM (e.g. net10.0) whose path depth differs; publish artifacts present but under an unexpected platform directory name.","solutions":["Rebuild the tool so outputs land in the recognized published layout (bin/<config>/<tfm>/publish/<BinaryDirectoryForPlatform>).","Confirm the TFM folder name matches what the toolchain emits.","If the layout legitimately changed, update BinaryDirectoryForPlatform / the candidate match logic in IL2CPPUtils to recognize the new structure."],"exampleFix":"/* no source edit */\n// before: outputs at bin/Release/net8.0/<unknown>/il2cpp.exe (unrecognized)\n// after: publish with bee so output lands at\n//   bin/Release/net8.0/publish/<BinaryDirectoryForPlatform(platform)>/il2cpp.exe","handlingStrategy":"validation","validationCode":"// After collecting candidates, verify at least one matches a recognized layout\nbool recognized = candidates.Any(c =>\n    c.Parent.Parent.Parent.FileName == \"bin\" ||\n    (c.Parent.FileName == \"publish\" && c.Parent.Parent.FileName == expectedPublishDirectoryName));\nif (!recognized) throw new InvalidOperationException(\"IL2CPP tool output layout unrecognized; rebuild with the published layout.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build the toolchain with the published layout (publish/<BinaryDirectoryForPlatform>).","After upgrading the IL2CPP source tree, rebuild all tools so outputs match the expected structure."],"tags":["il2cpp","dev-build","toolchain","tfm","publish-layout"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}