-
Notifications
You must be signed in to change notification settings - Fork 52
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I change default EBWebView folder path. #295
Comments
You can set the user data folder in the CoreWebView2Environment.CreateAsync method. The second parameter is the user data folder, and the other two parameters may be null to use their default values. You can then have the WinForms WebView2 use your CoreWebView2Environment to create its CoreWebView2 by calling the WebView2.EnsureCoreWebView2Async method. However, you must call EnsureCoreWebView2Async before you set the WebView2.Source property as setting that property implicitly causes initialization to begin with a default CoreWebView2Environment. This is likely how you were seeing the default user data folder getting created. You can read more about WinForms WebView2 control initialization in the WebView2.EnsureCoreWebView2Async documentation. And for reference, here are some more notes on the user data folder. |
Can you make a property for this in the WebView2 control? It would be better to set the path after the InitializeComponent method. |
The WinForms & WPF WebView2 controls have a CreationProperties property you can also use to more easily set the UserDataFolder via the designer or xaml. |
Why not have a more sensible default though, like for example, the application data folder where .NET automatically stores other stuff (like the application settings) ? |
When we use WebView2 in Windows form application and first time run it, It could create exe-name.webview2/EBWebView folder in the executable file path. How can I set the new location of it before first running.
The text was updated successfully, but these errors were encountered: