Unity-Technologies/UnityCsReference · error · InvalidOperationException

{name} does not appear to be built in {il2CppFolder}

Error message

{name} does not appear to be built in {il2CppFolder}

What it means

Thrown by GetLibrarySearchPaths when operating in a dev IL2CPP location: it searches <topLevel>/<customRoot?>/<name>/bin for assemblies whose parent folder name equals the requested TFM, and if none are found it reports the tool isn't built in that folder.

Source

Thrown at Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:649

            if (isDevelopmentLocation)
            {
                // Locating the correct development build to use is a little tricky.  Complications come from
                // 1) We don't know if the Debug or Release build is desired.  To overcome this we will pick whichever was modified most recently

                var topLevel = il2CppFolder;
                if (customRoot != null)
                    topLevel = Path.Combine(topLevel, customRoot);

                var toolBinDirectory = Path.Combine(topLevel, name, "bin").ToNPath();
#pragma warning disable UA2001 // The Banned API Analyzer produces compile errors for any new Linq code. This pre-existing usage has been suppressed, but should be rewritten if possible.
                var candidates = toolBinDirectory.Files($"*{expectedToolExecutableName}", recurse: true)
#pragma warning restore UA2001
                    .Where(f => f.Parent.FileName == tfm)
                    .OrderByDescending(f => f.GetLastWriteTimeUtc())
                    .ToArray();

                if (candidates.Length == 0)
                    throw new InvalidOperationException($"{name} does not appear to be built in {il2CppFolder}");

                return candidates[0].Parent.ToString();
            }

            throw new ArgumentException($"Could not locate assembly for {name}");
        }

        internal static string ConstructBeeLibrarySearchPath()
        {
            var projectBinDirs = new[]
            {
                GetLibrarySearchPaths("Unity.Options", "netstandard2.0", "external/UnityOptions"),
                GetLibrarySearchPaths("Unity.Linker.Api", "netstandard2.0"),
                GetLibrarySearchPaths("Unity.IL2CPP.Api", "netstandard2.0"),
                GetLibrarySearchPaths("Unity.Api.Attributes", "netstandard2.0"),
                GetLibrarySearchPaths("Unity.IL2CPP.Bee.IL2CPPExeCompileCppBuildProgram.Data", "netstandard2.0"),
                GetLibrarySearchPaths("Unity.IL2CPP.Bee.BuildLogic", "net10.0"),
                // Now the quirky part.  We need to locate the platform build logic assemblies.

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Build the specific support assembly in the dev enlistment so bin/<config>/<tfm>/<name>.dll exists.
  2. Ensure the requested TFM string matches the TFM the toolchain actually built (check bin subfolders).
  3. Build the whole IL2CPP bee solution so all required libraries are present.

Example fix

/* no source edit */
// before: GetLibrarySearchPaths("Unity.IL2CPP.Api", "netstandard2.0") -> throws
// after: build Unity.IL2CPP.Api first
//   bee Unity.IL2CPP.Api::Unity.IL2CPP.Api
// then ConstructBeeLibrarySearchPath() succeeds
Defensive patterns

Strategy: validation

Validate before calling

var dir = Path.Combine(topLevel, customRoot ?? "", name, "bin");
if (!Directory.Exists(dir) ||
    !Directory.EnumerateDirectories(dir, tfm, SearchOption.AllDirectories).Any())
    throw new InvalidOperationException($"Build {name} for TFM {tfm} in {dir} before constructing the search path.");

Prevention

When it happens

Trigger: GetLibrarySearchPaths("Unity.Options", "netstandard2.0", ...) or similar is called while isDevelopmentLocation is true, but the named assembly was never compiled to bin/<config>/<tfm>/, or the TFM string passed does not match any actual output folder.

Common situations: Constructing the bee library search path (ConstructBeeLibrarySearchPath) against an IL2CPP enlistment missing one of the required support assemblies (Unity.Options, Unity.Linker.Api, etc.); passing a TFM like 'net10.0' when outputs are actually under 'netstandard2.0'.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/f98c56fd48ab2a8d. Report an issue: GitHub.