This repository was archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started CefSharp Winapi
softoille@gmail.com edited this page Nov 29, 2019
·
1 revision
Note: Visual Studio 2017 is preferred. Recent older versions like 2015 should work too but not supported.
- Create .NET Console Application
- Ensure that the build platform target is x64.
- From project property, change "Console Application"" to "Windows Application" [Project -> Properties -> Application -> Output type: "Windows Application"].
- Add Chromely.CefSharp.Winapi from Nuget-prelease. (A warning may show, if this happens unload the project and reload.)
- Chromely.CefSharp.Winapi has following dependencies and should be verified
- Winapi from Nuget. (Ensure minimum of 4.0 version is installed that was released for .NET Standard.)
- CefSharp.Common from Nuget.
- Chromely.Core from Nuget- prelease
- Step 4 should add all the required CefSharp libraries and required Cef files.
- If above is not done, try step 5 otherwise move to step 6.
- Get Cef binaries from download page. Base Chromium version 57 or above (64-bit). Chromium version must match CefSharp version installed in Step 4.
- Copy all files and folders from /Release to the appropriate bin folder - where the project exe file is located.
- Copy all files and folders from /Resources to appropriate bin folder - where the project exe file is located.
- You may have to Unload/Load project before CefSharp libraries can be visible as references in the project.
- Ensure Configuration is set at x64 as active platform. You may get an error: "CefSharp.Common will work out of the box if you specify platform (x86 / x64)" if this is not done.
- Add the following code snippet to the Main function in Program.cs.
Notes on Upgrade to CefGlue version 70 and CefSharp version 71 (Chromely v4) - Please see.
class Program
{
static int Main(string[] args)
{
string startUrl = "https://google.com";
ChromelyConfiguration config = ChromelyConfiguration
.Create()
.WithHostMode(WindowState.Normal, true)
.WithHostTitle("chromely")
.WithHostIconFile("chromely.ico")
.WithAppArgs(args)
.WithHostSize(1000, 600)
.WithStartUrl(startUrl);
using (var window = ChromelyWindow.Create(config))
{
return window.Run(args);
}
}
}
- Creates Chromely window of size 1000 x 600 pixels.
- Sets the window title to "chromely"
- Sets start url to "https://google.com"
- Centers the window
- Build the project.
- Run the built exe file.
- If successful the following will be shown:
Chromely
Getting Started
The Basics
Digging Deeper
- Sub-Process
- Infrastructure
- Restful Resources
- Register Resource Assemblies
- Custom Local Resource Handling
- Custom Scheme Handling
- Expose .NET class to JavaScript
- Generic Message Routing
- Real-time with Websocket
- External Url Registration
Angular - React - Vue