使用 CefSharp 构建 x64 项目

Build x64 project with CefSharp

我尝试编译我的应用程序,它有 CefSharp 作为依赖项。以 x86 为目标时一切正常,但对于 x64,我收到以下错误:

System.BadImageFormatException: 'Could not load file or assembly 'CefSharp, Version=67.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. An attempt was made to load a program with an incorrect format.'

有什么想法吗?谢谢

这是我在 VS 2017 中的配置设置的屏幕截图,

和项目属性的构建选项卡:

Hans Passant 在评论中写道:

The solution platform name is irrelevant for C# projects. There is only one setting that matters and its value is not related to the platform name. Right-click your EXE project > Properties > Build tab. You only get 64-bit execution with Platform target = AnyCPU and Prefer 32-bit unticked. You probably have "Prefer 32-bit" ticked now (the default), so kaboom when it tries to load x64 unmanaged code.

这正是问题所在。谢谢汉斯!