I had followed this link to implement CefSharp applicaton.
But I have stuck while coding MainWindow.xaml
.
Blend for VS 2015 said,
You can read in the (Documentation) of the NuGet package, it's also necessary to add an app.manifest
to your Application.
For me the problem was that the solution platform was set to AnyCPU.
As far as I know, CefSharp does not support AnyCPU. Interestingly the solution ran just fine in Release mode, but in Debug mode I immediately got an error - the invocation of the constructor on type that matches ... the specified binding constraints threw an exception.
As soon as I changed the solution platform to be only x64, then the XAML error went away (The name ChromiumWebBrowser does not exist in the namespace “clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf”
). And I could run the solution both in Debug and Release mode.
its not supported in the XAML desginer, so load it in run time:
Remove the element from the XAMl, and instead place any container such as a Border:
<Border x:Name="cefChromeContainer" />
in the Constructor code, after InitializeComponent();
call, craete the browser element and place into the container. even better to declare the browser in the class scoop:
CefSharp.Wpf.ChromiumWebBrowser browser = new CefSharp.Wpf.ChromiumWebBrowser();
public MainWindow()
{
InitializeComponent();
cefChromeContainer.Content = browser;
browser.Address = "https://stackoverflow.com";
}
I just tried the link, and as I mentioned in the comments it compiles without any problem.
Can be ignored.
And the preview is not available as well, I learned to live with it.
No errors when compiling
And the program starts up. No problem
I had the same problem and i solve it changing configuration to from "debug" to "release" and using "x64" as platform.
But it was not enought to change it from the solution menú, as i usually do. You need to go to visual studio main menú under "Compile > Configuration administration", as you can see in the following link from Microsoft:
https://docs.microsoft.com/es-es/visualstudio/ide/how-to-configure-projects-to-target-platforms?view=vs-2015&redirectedfrom=MSDN#Anchor_0
This solution was in fact in the Readme.txt file for cefsharp, as stated in the "Documentation" link provided by saschad in his answer: https://github.com/cefsharp/CefSharp/blob/cefsharp/69/NuGet/Readme.txt
There you can read it:
- For
x86
or x64set your solution target architecture to
x86or
x64`, just changing the project is currently not enough (See https://msdn.microsoft.com/en-us/library/ms185328.aspx#Anchor_0 for details).
Now I have it running like a charm :D