CefSharp not working in project targeting AnyCpu platform.

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CefSharp not working in project targeting AnyCpu platform.

Postby VijrumbhanM » Thu Mar 08, 2018 7:46 am

Hi Team,

I am new to CEF and I have been trying to embed Chrome browser control in my WPF Application but have been facing problems.
I have downloaded cefsharp 63 from NUGet and referenced the dlls in my project, since my main WPF application targets AnyCpu platform i have followed the intructions posted by author in git https://github.com/cefsharp/CefSharp/issues/1714. the instructions seemed to work in a separate application and i could successfully embed chromiumbrowser in a WPF window.

i am trying to do the same in my main application, my main solution has 6 projects where chromiumbrowser window must be opened, so i have
-done the changes (resolver event) to app.xaml.cs file of my main application that generates an exe.
-config changes and project file changes to add a new tag <CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>.

I have performed the above changes to my main application (startup project) . I have a usercontrol project in which i gave created a usercontrol which hosts chromiumbrowser. i use the following control in a wpfwindow.
when the code creates an instance of the window that is hosting cefsharp.wpf chromiumbrowser it fails with the following runtime error

{System.Windows.Markup.XamlParseException: 'The invocation of the constructor on type 'CefSharp.Wpf.ChromiumWebBrowser' that matches the specified binding constraints threw an exception.' Line number '12' and line position '10'. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies. The specified module could not be found.
at CefSharp.Wpf.ChromiumWebBrowser.NoInliningConstructor()
at CefSharp.Wpf.ChromiumWebBrowser..ctor() in c:\projects\cefsharp\CefSharp.Wpf\ChromiumWebBrowser.cs:line 402
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at CefSharp.WpfSample.MainWindow.InitializeComponent() in d:\Projects\CefSharp.anycpu\CefSharp.WpfSample\MainWindow.xaml:line 1
at CefSharp.WpfSample.MainWindow..ctor() in d:\Projects\CefSharp.anycpu\CefSharp.WpfSample\MainWindow.xaml.cs:line 9
at TestPlans.ViewModel.ReportViewModel.<BrowseAndAddReports>d__64b.MoveNext() in d:\Projects\TestPlans.Usage\ViewModel\ReportViewModel.cs:line 5698}


Note : i will be calling cefsharp initialize only when the cefbrowser window is instantiated not in App.xaml.cs. as i need to apply current session cookies .

Thanks,
Vijrumbhan
VijrumbhanM
Newbie
 
Posts: 1
Joined: Thu Mar 08, 2018 6:36 am

Re: CefSharp not working in project targeting AnyCpu platfor

Postby Czarek » Wed Mar 14, 2018 1:43 pm

Wrong forum.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 31 guests