egametang/ET · error · BuildFailedException

can't find xxxx.xcodeproj/project.pbxproj in {pathToBuiltPro

Error message

can't find xxxx.xcodeproj/project.pbxproj in {pathToBuiltProject}

What it means

Thrown by BuildProcessorUtil.GetXcodeProjectFile when no subdirectory matching *.xcodeproj containing a project.pbxproj file is found inside the given build output path. This function is called during iOS post-build processing to locate the Xcode project that Unity should have generated, so it can be patched with HybridCLR-specific modifications.

Source

Thrown at Packages/cn.etetet.hybridclr/Scripts/Editor/Share/BuildProcessors/BuildProcessorUtil.cs:21

using UnityEditor.Build;

namespace HybridCLR.Editor.BuildProcessors
{

	public static class BuildProcessorUtil
	{

        public static string GetXcodeProjectFile(string pathToBuiltProject)
        {
            foreach (string dir in Directory.GetDirectories(pathToBuiltProject, "*.xcodeproj", SearchOption.TopDirectoryOnly))
            {
                string pbxprojFile = $"{dir}/project.pbxproj";
                if (File.Exists(pbxprojFile))
                {
                    return pbxprojFile;
                }
            }
            throw new BuildFailedException($"can't find xxxx.xcodeproj/project.pbxproj in {pathToBuiltProject}");
        }
    }
}

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Verify the build target is iOS and that the build completed successfully, producing an .xcodeproj in the output folder.
  2. Check that pathToBuiltProject points to the directory Unity actually wrote the Xcode project to.
  3. Manually inspect the build output directory for a .xcodeproj folder — if absent, re-run the build.
  4. Ensure no post-build script moved or deleted the Xcode project before this code runs.

Example fix

// before
string pbxproj = BuildProcessorUtil.GetXcodeProjectFile(pathToBuiltProject);

// after — check existence first with a clear error
string[] xcodeDirs = Directory.GetDirectories(pathToBuiltProject, "*.xcodeproj", SearchOption.TopDirectoryOnly);
if (xcodeDirs.Length == 0)
{
    Debug.LogError($"No .xcodeproj found in {pathToBuiltProject}. Verify iOS build completed and output path is correct.");
    return;
}
string pbxproj = BuildProcessorUtil.GetXcodeProjectFile(pathToBuiltProject);
Defensive patterns

Strategy: validation

Validate before calling

string[] xcodeProjects = Directory.GetDirectories(pathToBuiltProject, "*.xcodeproj", SearchOption.TopDirectoryOnly);
if (xcodeProjects.Length == 0)
{
    Debug.LogError($"No .xcodeproj found in '{pathToBuiltProject}'. " +
        "Verify the build target is iOS, the build completed, and the output path is correct.");
    return;
}

Type guard

static bool HasXcodeProject(string path)
{
    return Directory.GetDirectories(path, "*.xcodeproj", SearchOption.TopDirectoryOnly).Length > 0;
}

Try / catch

try
{
    string pbxproj = BuildProcessorUtil.GetXcodeProjectFile(pathToBuiltProject);
}
catch (BuildFailedException ex) when (ex.Message.Contains("project.pbxproj"))
{
    Debug.LogError($"Xcode project not found at '{pathToBuiltProject}'. " +
        "Ensure the iOS build completed and the output path in Player Settings is correct.");
}

Prevention

When it happens

Trigger: GetXcodeProjectFile is called with a pathToBuiltProject that does not contain a *.xcodeproj directory. This happens when the build target is iOS but Unity did not export an Xcode project (e.g. the build path is wrong, the build failed silently, or the export went to a different location), or when the build target is not iOS at all.

Common situations: The build output path in Player Settings does not match the actual export location; the iOS build failed or was interrupted before the Xcode project was created; calling post-build processing code for a non-iOS platform; the path contains a typo or stale reference from a previous configuration.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/9a3e4ed8d228417b. Report an issue: GitHub.