CefSharp Core Runtime dll incorrect format

0

I am getting System.IO.FileNotFoundException: 'Could not load file or assembly 'CefSharp.Core.Runtime, Version=89.0.170.0, 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.

C:\Users\{user}\.nuget\packages\cefsharp.common.netcore\89.0.170\runtimes\win-x64\lib\netcoreapp3.1

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);
            try
            {
                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

packages\cefsharp.common.netcore\89.0.170\runtimes\win-x64\lib\netcoreapp3.1

CefSharp.Core.dll

CefSharp.dll

CefSharp.Core.Runtime.dll

packages\cefsharp.offscreen.netcore\89.0.170\lib\netcoreapp3.1

CefSharp.OffScreen.dll

EDIT 3 - updated bin

enter image description here

c#
cefsharp
cefsharp.offscreen
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