次の方法で共有


CoreWebView2Profile.AddBrowserExtensionAsync(String) Method

Definition

Add a browser extension to the current user profile from extensionFolderPath.

public System.Threading.Tasks.Task<Microsoft.Web.WebView2.Core.CoreWebView2BrowserExtension> AddBrowserExtensionAsync (string extensionFolderPath);
member this.AddBrowserExtensionAsync : string -> System.Threading.Tasks.Task<Microsoft.Web.WebView2.Core.CoreWebView2BrowserExtension>
Public Function AddBrowserExtensionAsync (extensionFolderPath As String) As Task(Of CoreWebView2BrowserExtension)

Parameters

extensionFolderPath
String

The manifest.json folder path.

Returns

Remarks

Adds the browser extension using the extension path for unpacked extensions from the local device. Extension is running right after installation. The extension folder path is the topmost folder of an unpacked browser extension and contains the browser extension manifest file. If the extensionFolderPath is an invalid path or doesn't contain the extension manifest.json file, this function will return ERROR_FILE_NOT_FOUND to callers. Installed extension will default IsEnabled to true. When AreBrowserExtensionsEnabled is false, AddBrowserExtension will fail and return HRESULT ERROR_NOT_SUPPORTED. During installation, the content of the extension is not copied to the user data folder. Once the extension is installed, changing the content of the extension will cause the extension to be removed from the installed profile. When an extension is added the extension is persisted in the corresponding profile. The extension will still be installed the next time you use this profile. When an extension is installed from a folder path, adding the same extension from the same folder path means reinstalling this extension. When two extensions with the same Id are installed, only the later installed extension will be kept. The following summarizes the possible error values that can be returned from AddBrowserExtension and a description of why these errors occur.

Error value | Description --- | --- HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) | Extensions are disabled. HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) | Cannot find manifest.json file or it is not a valid extension manifest. E_ACCESSDENIED | Cannot load extension with file or directory name starting with _, reserved for use by the system. E_FAIL | Extension failed to install with other unknown reasons.

Applies to