WebKit .NET is a WinForms control library wrapper for WebKit written in C#. The aim is to make it easy for developers to incorporate WebKit into their .NET applications.
For more information please visit the links to the left or the project homepage on SourceForge.
Requirements
Windows with .NET Framework
Due to the requirements of both the WebKit library and the .NET framework, WebKit .NET will only run on fairly modern Windows systems. As of version 0.4, the minimum requirements include:
- Windows XP SP3 or higher
- Microsoft .NET Framework 2.0 - download for x86 | x64
- Microsoft Visual C++ 2008 SP1 runtime libraries with ATL security update (x86) - download
The WebKit .NET 0.4 binary package has been tested successfully on a fresh install of Windows XP with only the above dependencies installed. On Windows Vista, only the Visual C++ runtime security update must be installed. This will be done via Windows Update if you have automatic updates enabled.
The above requirements also assume that the provided WebKit library was built using Visual C++ 2008 and with Cairo support (this is the case with the compiled libraries provided here). If you have aquired a WebKit binary from somewhere else or build one yourself then the requirements may be different. Please see Building WebKit or the WebKit project site for more information.
Due to the requirements of both the WebKit library and the .NET framework, WebKit .NET will only run on fairly modern Windows systems. As of version 0.4, the minimum requirements include:
- Windows XP SP3 or higher
- Microsoft .NET Framework 2.0 - download for x86 | x64
- Microsoft Visual C++ 2008 SP1 runtime libraries with ATL security update (x86) - download
The WebKit .NET 0.4 binary package has been tested successfully on a fresh install of Windows XP with only the above dependencies installed. On Windows Vista, only the Visual C++ runtime security update must be installed. This will be done via Windows Update if you have automatic updates enabled.
The above requirements also assume that the provided WebKit library was built using Visual C++ 2008 and with Cairo support (this is the case with the compiled libraries provided here). If you have aquired a WebKit binary from somewhere else or build one yourself then the requirements may be different. Please see Building WebKit or the WebKit project site for more information.
Windows with Mono
Not supported (as of version 0.4).
Not supported (as of version 0.4).
Linux with Mono
Not supported (as of version 0.4).
Not supported (as of version 0.4).
Building WebKit .NET
0. Requirements
Before you begin, make sure that your system meets the requirements.
Before you begin, make sure that your system meets the requirements.
1. Obtaining WebKit .NET Source
You can either download the most recent source release from the project download page, or check out the latest source from GitHub.
If you downloaded the source package, extract it to a folder somewhere on your local machine, for example D:/webkitdotnet.
You can either download the most recent source release from the project download page, or check out the latest source from GitHub.
If you downloaded the source package, extract it to a folder somewhere on your local machine, for example D:/webkitdotnet.
2. Obtaining WebKit
In order to build and use WebKit .NET, you must have a compiled WebKit library available. There are a number of different ways you can obtain this:
- Download the latest WebKit .NET binary release from the project download page. This includes the Cairo build of the WebKit library and all of it dependencies.
- Build WebKit yourself from source.
- Download a WebKit nightly build. Note that these are builds of the Apple port and as such require a number of libraries that are not freely redistributable. They are however included with Safari. A brief guide to using these nightly builds with WebKit .NET can be found here.
When you have aquired a suitable binary, copy WebKit.dll and it's various dependencies into webkitdotnet/webkit. Note that if you downloaded the binary package, make sure you do NOT copy WebKitBrowser.dll, WebKitBrowser.dll.manifest or WebKitBrowserTest.exe into this directory.
In order to build and use WebKit .NET, you must have a compiled WebKit library available. There are a number of different ways you can obtain this:
- Download the latest WebKit .NET binary release from the project download page. This includes the Cairo build of the WebKit library and all of it dependencies.
- Build WebKit yourself from source.
- Download a WebKit nightly build. Note that these are builds of the Apple port and as such require a number of libraries that are not freely redistributable. They are however included with Safari. A brief guide to using these nightly builds with WebKit .NET can be found here.
When you have aquired a suitable binary, copy WebKit.dll and it's various dependencies into webkitdotnet/webkit. Note that if you downloaded the binary package, make sure you do NOT copy WebKitBrowser.dll, WebKitBrowser.dll.manifest or WebKitBrowserTest.exe into this directory.
3. Building
Open webkitdotnet/WebKit.NET.sln in Visual Studio 2008, or equivalent, and select 'Build -> Build Solution' from the menu. If you wish to try the test web browser application, right-click the WebKitBrowserTest project in the Solution Explorer and select 'Set as Startup Project', then select 'Debug -> Start Without Debugging' from the menu.
The compiled library can be found in a subdirectory of webkitdotnet/bin.
Open webkitdotnet/WebKit.NET.sln in Visual Studio 2008, or equivalent, and select 'Build -> Build Solution' from the menu. If you wish to try the test web browser application, right-click the WebKitBrowserTest project in the Solution Explorer and select 'Set as Startup Project', then select 'Debug -> Start Without Debugging' from the menu.
The compiled library can be found in a subdirectory of webkitdotnet/bin.
Building WebKit
The guide below details the process for building the Cairo port of WebKit and is based on this guide on the WebKit project wiki, with a few changes.
The guide below details the process for building the Cairo port of WebKit and is based on this guide on the WebKit project wiki, with a few changes.
0. Setting up a Build Environment
Follow the instructions at http://webkit.org/building/tools.html to install either Visual Studio 2005 or Visual C++ 2005 express, various service packs and updates, and Cygwin.
Follow the instructions at http://webkit.org/building/tools.html to install either Visual Studio 2005 or Visual C++ 2005 express, various service packs and updates, and Cygwin.
1. Obtaining the WebKit Source
From within Cygwin, run the following command to download the WebKit source tree. It is advised to build WebKit in your cygwin home directory.
svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit
Next, download the WebKit Support Libraries to the root of the WebKit source tree. Make sure it is named WebKitSupportLibrary.zip. Do not extract it's contents.
Finally, in Windows, set the following environment variables by right-clicking My Computer -> Properties -> Advanced Settings -> Advanced -> Environment Variables:
WEBKITOUTPUTDIR - (e.g. <webkitroot>\WebKitBuild)
WEBKITLIBRARIESDIR - (path to <webkitroot>\WebKitLibraries\win)
From within Cygwin, run the following command to download the WebKit source tree. It is advised to build WebKit in your cygwin home directory.
svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit
Next, download the WebKit Support Libraries to the root of the WebKit source tree. Make sure it is named WebKitSupportLibrary.zip. Do not extract it's contents.
Finally, in Windows, set the following environment variables by right-clicking My Computer -> Properties -> Advanced Settings -> Advanced -> Environment Variables:
WEBKITOUTPUTDIR - (e.g. <webkitroot>\WebKitBuild)
WEBKITLIBRARIESDIR - (path to <webkitroot>\WebKitLibraries\win)
2. Build Requirements
Download the build requirements from here. Extract the contents to a directory, e.g. <webkitroot>\WebKitLibraries\win\requirements, and add the underlying 'include' and 'lib' directories to the Visual C++ 2005 directory list.
Download the build requirements from here. Extract the contents to a directory, e.g. <webkitroot>\WebKitLibraries\win\requirements, and add the underlying 'include' and 'lib' directories to the Visual C++ 2005 directory list.
3. Update and Build
In Cygwin, from your home directory, run the following command to update the WebKit source tree and install the support libraries:
WebKit/WebKitTools/Scripts/update-webkit
Finally, to build WebKit, run the following command (optionally use the --debug switch instead of --release):
WebKit/WebKitTools/Scripts/build-webkit --release --cairo-win32
If successful, the build process will likely take a few hours. The output will be found in the directory specified in the WEBKITOUTPUTDIR environment variable.
In Cygwin, from your home directory, run the following command to update the WebKit source tree and install the support libraries:
WebKit/WebKitTools/Scripts/update-webkit
Finally, to build WebKit, run the following command (optionally use the --debug switch instead of --release):
WebKit/WebKitTools/Scripts/build-webkit --release --cairo-win32
If successful, the build process will likely take a few hours. The output will be found in the directory specified in the WEBKITOUTPUTDIR environment variable.
4. Dependencies
Binary dependencies for the build can be found in the 'bin' subdirectory of the requirements downloaded in step 2. These requirements may change from time to time - you might need to experiment to find out exactly what is and isn't needed.
Binary dependencies for the build can be found in the 'bin' subdirectory of the requirements downloaded in step 2. These requirements may change from time to time - you might need to experiment to find out exactly what is and isn't needed.
5. Common Problems
See Common Build Errors on the WebKit wiki for solutions to some commonly faced problems.
See Common Build Errors on the WebKit wiki for solutions to some commonly faced problems.
參考文獻
- WebKit .NET
- Is there an embeddable Webkit component for Windows / C# development?
陳鍾誠 (2011年12月20日),(網頁標題) C# 視窗程式 — WebKit 瀏覽器,(網站標題) 免費電子書:C# 程式設計,2011年12月20日,取自 http://cs0.wikidot.com/webkitbrowser ,網頁修改第 0 版。