WebKit .NET

Tutorial - The Basics

Running the Application

Before we can run the program, there are a few important things still to do.

Changing the Application Platform

As there is no x64 build of WebKit yet, WebKit .NET is configured to run only as a 32-bit process so that it functions correctly on 64-bit versions of Windows. As a consequence of this, ALL .NET applications which use WebKit .NET must also be configured in this way. By default, C# applications will run as a 64-bit process on Win64, and we will get an error if we try to use a 32-bit library with them. To change the platform, right click the project in the Solution Explorer and select 'Properties'. Select the 'Build' tab and choose 'x86' as the platform (by default it will be set to 'Any CPU').

We can now build the application (Build -> Build Solution) but it will not run yet without the WebKit library.

WebKit and Dependencies

Before we can run the application, WebKit.dll and it's dependencies must be present in the output directory. In Windows Explorer (or otherwise), copy all of the files from the WebKit .NET 'bin' directory to your project's output directory. For example, here is the listing of my output directory after copying:

D:\webkitdotnet\WebKitTest\WebKitTest\bin\Debug>ls CFLite.dll icudt40.dll JavaScriptCore.dll icuin40.dll JavaScriptCore.resources icuuc40.dll SQLite3.dll libcurl.dll WebKit.Interop.dll libcurl.dll.manifest WebKit.dll libeay32.dll WebKit.resources libeay32.dll.manifest WebKitBrowser.dll libpng13.dll WebKitBrowser.dll.manifest libxml2.dll WebKitBrowser.pdb libxslt.dll WebKitTest.exe pthreadVC2.dll WebKitTest.pdb ssleay32.dll WebKitTest.vshost.exe ssleay32.dll.manifest WebKitTest.vshost.exe.manifest zlib1.dll curl.exe.manifest

Alternatively, you could create a post-build event that automatically copies the WebKit files to the output directory after each successful build.

We can now finally run the test application - select 'Start Without Debugging' from the Debug menu within Visual C#. Our web browser should appear:

Adding WebKitBrowser to form
Adding WebKitBrowser to form

This concludes the tutorial. It is left as an exercise to implement back, forward and home navigation buttons, or browser tabs if you're feeling ambitious! You may want to have a look at the test browser application included in the WebKit .NET source.