CefSharp Core Runtime dll incorrect format


I am getting System.IO.FileNotFoundException: 'Could not load file or assembly 'CefSharp.Core.Runtime, Version=, Culture=neutral, PublicKeyToken=40c4b6fc221f4138'. The system cannot find the file specified.' the file is there and in the bin directory along with the other dlls.

Project set up:

Console app targeting netcore 3.1 consumes a class library targeting netstandard 2.0 which loads in a driver built using netcore app 3.1 which has CefSharp.Offscreen 89.0.170

When stepping through the debugger I am seeing that I cannot load the CefSharp.Core.Runtime.dll which CefSharp.Core depends on. An attempt was made to load a program with an incorrect format. (0x8007000B).

The dlls are taken from the x64 folder of the cef nuget package and reflect that in the csproj.


I am at a loss as to what is causing this, has anyone got any suggestions on where to look and what could be the cause?

EDIT 1 -- code to clarify

    private static System.Reflection.Assembly Resolver(object sender, ResolveEventArgs args)
            if (!args.Name.StartsWith("CefSharp.Core.Runtime")) return null;
            string assemblyName = args.Name.Split(new[] {','}, 2)[0] + ".dll";
            string archSpecificPath = $"E:\\myProject\\bin\\Debug\\netcoreapp3.1\\{assemblyName}";
            // this returns true
            var exists = File.Exists(archSpecificPath);
                return System.Reflection.Assembly.LoadFile(archSpecificPath);
            catch(Exception e)
                // e's value: "An attempt was made to load a program with an incorrect format. (0x8007000B)"
                return null;

EDIT 2 - contents of bin and where they're from







EDIT 3 - updated bin

enter image description here

asked on Stack Overflow May 6, 2021 by PurpleSmurph • edited May 6, 2021 by PurpleSmurph

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0