Distributing CEFSharp Winforms (x86) - Trying to keep my application as AnyCPU

0

I have a .NET Application (VB Winforms) that runs a main executable. On startup this executable will search for plugins and will load them in using System.Reflection.Assembly.Load()

I then use interfaces to add menu icons from the plugins into the main app's icon bar so forms from the plugins can be shown .. You get the idea.

Now, this application currently runs with a Target platform of AnyCPU. My thinking behind this was so the application would work on both x86/x64 platforms. If installed on x86 it would have the 2GB memory limitation, but would also be available on x64 and run freely (This is how it works - Right?)

Now, i want to show help files from my Website inside an embedded browser - I've chosen CEFSharp Chromium Browser and it works brilliantly, however CEFSharp MUST have a Target Platform of either x86 or x64 specifically set.

I've created a plugin to hold the browser and set this project to a target platform of x86 (64 bit operating systems can still run x86 apps - So this should work for both), my thinking was that i could load this plugin into the application however when i do so i get the following error:

Could not load file or assembly 'XIBrowser.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"} System.BadImageFormatException: {"Could not load file or assembly 'XIBrowser.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"}

It appears that i can't load the project without the main application being set to Target platform of x86 which means i loose all the benefits of running it on a x64 bit OS.

So ... Is there any way around this? I don't really want to maintain two versions of my application for x86 and x64.

Does anyone have any ideas of how to run CEFSharp but still keep my AnyCPU target?

.net
winforms
64-bit
chromium-embedded
cefsharp
asked on Stack Overflow Jul 3, 2016 by Mark G

1 Answer

0

Yes - You're all correct. No way around it.

I've now converted my Target Framework to x86 and i'm running the x86 version of CEFSharp. All working fine.

I wrapped an interface around it and dumped it into a new project, so if i ever need to run a x64 version then it'll be really easy to convert.

Thanks all.

answered on Stack Overflow Jul 8, 2016 by Mark G

User contributions licensed under CC BY-SA 3.0