To write about the hybrid development of PC side and why to study the mixed development with Cefsharp for several days, have been busy, can not spare time to continue to write how to build cefsharp development environment. In fact, no time is an excuse, everything is lazy, no love to the depths.
Today continue to write how to build cefsharp environment, develop WinForm, web hybrid applications.
One, download the assembly DLL.
The assembly is in HTTPS://WWW.NUGET.ORG/PACKAGES/CEFSHARP.WINFORMS/37.0.0-PRE02. All dependent libraries are easily available through NuGet. If your network is not good, you can download it first and then add references to the project. The minimum assembly and resource needs such as
The simplest way is to get through the package, Install-package Cefsharp.winforms-pre
Second, the project is configured as x86 or x64 target platform
After adding the project to compile, you will encounter the following error.
Cefsharp.common does not work correctly on ' AnyCPU ' platform. You need to specify platform (x86/x64). This error is actually a flaw in Cefsharp. Cefsharppic's project team said it would fix the bug later. We'll settle the problem now. is to change the target platform of the project to x64 or x86.
Third, initialize Cefsharp and create add chromiumwebbrowser Display Web page.
public partial class Form1:form
{
CefSharp.WinForms.ChromiumWebBrowser webcom = null;
Public Form1 ()
{
InitializeComponent ();
Load +=form_load;
}
protected void Form_Load (object sender, EventArgs e)
{
webcom = new CefSharp.WinForms.ChromiumWebBrowser ("www.baidu.com");
Webcom.dock = DockStyle.Fill;
Panel1. Controls.Add (webcom);
Webcom.load ("www.baidu.com");
}
private void Btn_multichrome_click (object sender, EventArgs e)
{for (int i = 0; i < 5; i++) {
ChildForm child = new ChildForm ();
Child. Show ();
}
}
}
So winfrom can display Baidu homepage
Iv. personal problems encountered when setting up CEFSHARP environment for the first time.
1, did not initialize when the program starts CEFSHARP causes the added Chromiumwebbrowser control to display a gray.
2, the bin directory does not contain CefSharp.BrowserSubprocess.Core.dll, CefSharp.BrowserSubprocess.exe. With regard to the role of these two resource files, it is interesting to understand
The principle of multi-process architecture mechanism of the browser. Here is a material you can understand, to explain the mainstream browser multi-process architecture mechanism: Chrome, IE.
Is my validation, opening multiple Chromiumwebbrowser controls to display a Web page loads multiple CefSharp.BrowserSubprocess.exe processes.
This time I'll write it down here. Although the article does not have any technical content, but is their own practical experience and technology exploration, but also hope to get the support of the group of friends, but also their own if the cefsharp continue to have what harvest will continue to share here.
. NET developing chrome with Cefsharp Open Source Library (ii)