How to use WebView2 AddBrowserExtensionAsync in UWP?

Victor Chen 106 Reputation points
2024-12-09T06:04:18.1566667+00:00

Attempted to use webView.CoreWebView2.Profile.AddBrowserExtensionAsync(extensionPath) but received the exception "The request is not supported."

It's understood that AreBrowserExtensionsEnabled must be set to True, and the property is found in CoreWebView2EnvironmentOptions. However, CoreWebView2Environment.CreateAsync no longer allows passing CoreWebView2EnvironmentOptions parameters like in WPF.

What steps should be taken to resolve this? Is there something being overlooked?

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,152 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 19,746 Reputation points Microsoft Vendor
    2024-12-09T07:49:02.7266667+00:00

    Hello @Victor Chen ,

    Welcome to Microsoft Q&A!

    Please use CoreWebView2Environment.CreateWithOptionsAsync(CoreWebView2EnvironmentOptions) to enable the AreBrowserExtensionsEnabled.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.