Partager via


CoreWebView2Environment.SetLoaderDllFolderPath(String) Method

Definition

Set the path of the folder containing the WebView2Loader.dll.

public static void SetLoaderDllFolderPath (string folderPath);
static member SetLoaderDllFolderPath : string -> unit
Public Shared Sub SetLoaderDllFolderPath (folderPath As String)

Parameters

folderPath
String

The path of the folder containing the WebView2Loader.dll.

Exceptions

Thrown when WebView2Loader.dll has been successfully loaded.

Remarks

This function allows you to set the path of the folder containing the `WebView2Loader.dll`. This should be the path of a folder containing `WebView2Loader.dll` and not a path to the `WebView2Loader.dll` file itself. Note that the WebView2 SDK contains multiple `WebView2Loader.dll` files for different CPU architectures. When specifying folder path, you must specify one containing a `WebView2Loader.dll` module with a CPU architecture matching the current process CPU architecture. This function is used to load the `WebView2Loader.dll` module during calls to any other static methods on `CoreWebView2Environment`. So, the path should be specified before any other API is called in `CoreWebView2Environment` class. Once `WebView2Loader.dll` is successfully loaded this function will throw an InvalidOperationException exception. The path can be relative or absolute. Relative paths are relative to the path of the `Microsoft.Web.WebView2.Core.dll` module. If the `WebView2Loader.dll` file does not exist in that path or LoadLibrary cannot load the file, or LoadLibrary fails for any other reason, an exception corresponding to the LoadLibrary failure is thrown when any other API is called in `CoreWebView2Environment` class. For instance, if the file cannot be found a `DllNotFoundException` exception will be thrown.

Applies to