1

I'm using ChromiumWebBrowser for my program. I follow the steps in Github to set it to be any CPU. Then I've encounter a problem: I could not load UI XMAL Designer but I could run the code after closing MainWindow.xaml. And when I open UI Designer, it shows me:

enter image description here

And the error is:

The name 'ChromiumWebBrowser' does not exist in the namespace'clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf'.

But I've already put xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf".

I also check for the question here, but it does not help.

I'm looking for some suggestions. Thanks in advance!

HelloWorld
  • 77
  • 1
  • 6

1 Answers1

2

One option is to skip the "Any CPU" route and instead compile you WPF app to x86. This way you can get the designer to work more easily.

But as you mentioned, your app works in "Any CPU" even though the designer shows an error so if you can live without the WPF designer and just manually edit the XAML, things should work normally.

Here's the steps to make the Visual Studio's WPF designer to work with ChromiumWebBrowser in x86 WPF app:

  1. Create new WPF project
  2. Install Nuget-package CefSharp.Wpf 57.00
  3. If you now try to compile the solution, you'll see an error: CefSharp.Common will work out of the box if you specify platform (x86 / x64).
  4. Select Build - Configuration Manager
  5. Click "Active solution platform" - New Configuration manager
  6. Create x86 configuration and make sure it's active x86
  7. Build
  8. (Restart Visual Studio)
  9. Open MainPage.xaml and add the Chromium: WPF Chromium
  10. Designer and the app should work correcly Designer with Chromium
Mikael Koskinen
  • 12,306
  • 5
  • 48
  • 63