cefsharp/CefSharp · critical · Exception

Unable to locate required Cef/CefSharp dependencies:

Error message

Unable to locate required Cef/CefSharp dependencies:

What it means

DependencyChecker.AssertAllDependenciesPresent enumerates all required CEF/CefSharp files (native DLLs, .pak resources, locale files, the BrowserSubProcess executable) in the executing assembly's directory. If any are missing, it builds a detailed message listing each missing file and the search path, then throws.

Source

Thrown at CefSharp/DependencyChecker.cs:253

            {
                resourcesDirPath = nativeLibPath;
            }

            var missingDependencies = CheckDependencies(true, packLoadingDisabled, managedLibPath, nativeLibPath, resourcesDirPath, browserSubProcessPath, Path.Combine(localesDirPath, locale + ".pak"));

            if (missingDependencies.Count > 0)
            {
                var builder = new StringBuilder();
                builder.AppendLine("Unable to locate required Cef/CefSharp dependencies:");

                foreach (var missingDependency in missingDependencies)
                {
                    builder.AppendLine("Missing:" + missingDependency);
                }

                builder.AppendLine("Executing Assembly Path:" + nativeLibPath);

                throw new Exception(builder.ToString());
            }
        }
    }
}

View on GitHub (pinned to 16bc6e0711)

Solutions

  1. Read the exception message — it lists every missing file by name and the directory it searched.
  2. Clean and rebuild the project so CefSharp.AfterBuild.targets copies all required files.
  3. If publishing, ensure the publish profile includes all native files (set CopyLocal on the CefSharp packages or use a post-publish step).
  4. Verify the locale setting matches available .pak files in the locales folder (default en-US).

Example fix

// before — default dependency check fires and throws
Cef.Initialize(new CefSettings());

// after — explicitly check and report before init
try
{
    DependencyChecker.AssertAllDependenciesPresent(
        resourcesDirPath: AppDomain.CurrentDomain.BaseDirectory,
        browserSubProcessPath: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CefSharp.BrowserSubProcess.exe"));
}
catch (Exception ex)
{
    // log the full list of missing files, then fix deployment
    Console.Error.WriteLine(ex.Message);
    throw;
}
Defensive patterns

Strategy: validation

Validate before calling

// Run the dependency check explicitly with a clear error before Cef.Initialize
var baseDir = AppDomain.CurrentDomain.BaseDirectory;
try
{
    DependencyChecker.AssertAllDependenciesPresent(
        resourcesDirPath: baseDir,
        browserSubProcessPath: Path.Combine(baseDir, "CefSharp.BrowserSubProcess.exe"));
}
catch (Exception ex)
{
    Console.Error.WriteLine(ex.Message); // lists every missing file
    throw;
}

Try / catch

try
{
    Cef.Initialize(settings, performDependencyCheck: true);
}
catch (Exception ex) when (ex.Message.Contains("Unable to locate required Cef/CefSharp dependencies"))
{
    // The message body lists each missing file and the search path
    Console.Error.WriteLine(ex.Message);
    throw;
}

Prevention

When it happens

Trigger: Called automatically by Cef.Initialize when performDependencyCheck is true (the default), or manually. Any missing file in the checklist — libcef.dll, icudtl.dat, CefSharp.BrowserSubProcess.exe, locale .pak files, etc. — triggers the exception.

Common situations: Incomplete NuGet package restore. Build output directory cleaned or partially deployed. Running from a publish or clickonce output that did not include native files. Locale or resources directory path configured incorrectly.

Related errors


AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13). Data as JSON: /api/errors/7e5f76b7a0578ae6. Report an issue: GitHub.