-
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
WebView2 application doesn't work when installed in Program Files folder #297
Comments
@michael-russin is correct. If the program is to be installed in the Program Files folder, you need to use CoreWebView2Environment and specify the user data folder? Checkout our user data folder document here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/userdatafolder |
It would be good to improve the error message, and provide the link to the docs (e.g. aka.ms/bla). |
Yes, we should try to improve the error message in this case. The problem is, probably, as others noted, access denied to a path. |
What is the correct procedure for this. The Microsoft documentation doesn't show any working examples.
I validated that userDataFolder is C:\Users\myuser\AppData\Local\OurSoftware So how does one use the environment, as what would seem obvious does not work? |
Thanks for this, I got it working but I figured out a few things. "EnsureCoreWebView2Async" has to run before the "Source" value is set. So what I did is go to designer file and comment the source value (this.webView21.Source = new System.Uri("about:blank", System.UriKind.Absolute);) and then in my browser form constructor I have something like this:
I hope that helps :) |
Stay away from |
Thank you for the tip! 😁 |
I found that if you pump the message loop that you can utilize await, like this (sorry, it's in VB.net, use a conversion extension it if you need C#)
Then you can call AwaitSync(Init()) Also, make sure you don't set the .Source property until AFTER you have called EnsureCoreWebView2Async( ), or it will throw errors on some systems. |
Hi, just a small comment from a Dinosaur of programming: Thanks for creating the WebView2 component letting us Dinosaurs of the desktop be able to use a browser in our applications that is better than IE. |
Hi @SabrinaCs - sorry for the delay in response. We are actively working on improving the experience around using the User Data Folder. I'll make sure the documentation updates are captured there as well. Thanks! |
@DjSt3rios You are a legend man! |
Glad I could help. I use Visual Studio, so when I hovered over the function "EnsureCoreWebView2Async", in the description it says it will have no effect after setting the "Source" property. |
I've written an article with a sample that configures the user data you can find it here |
@DjSt3rios But when I run against the Octopus Deploy application, which is in the network "ssgprd/Octopus/MyAppName" The folder LocalData is created when I test my app in Program Files (x86) Directory But when I test in the Octopus Deployed Application, the folder "WebView" is created but empty: |
@limyandi The error says that a collection was modified while it was being enumerated. So perhaps you have a for/foreach loop and inside of it you modify the collection you are currently going through? |
Updated NSIS installer. Would be ready for release, but: MicrosoftEdge/WebView2Feedback#297
Updated NSIS installer. Would be ready for release, but: MicrosoftEdge/WebView2Feedback#297
code it working perfect for me
|
Thanks! Literally stuck on this issue for 2 days, was certain it was a dependency issue. I've recreated my setup project more than 10 times! Glad it's finally working now. |
Hey all - We've decided we aren't going to make further product or API changes here. We've improved the error messaging around this to make it both clearer when the user data folder can't be created, and added an error message when a dev is trying to set Source property which is overriding the explicit initialization with a user data folder. We've also updated our docs. Any further change would be a large breaking change, as well as introducing potentially bad practices around user data folder cleanup when uninstalling. Thanks! |
We weren't able to get any of the above mentioned solutions to work in our Blazor Maui app, but we found another workaround. During installation of the application, we create the folder Relevant links: |
I tried the example given by microsoft, C# Winforms .NET application https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms
it works perfectly in debug mode, but when install the program in the Program Files folder, the Navigate function does not work, I get
"Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. "
In fact CoreWebView2 is not initialized.
If install the application in a folder other than C:\Program files (86) it works, for example it works fine in a C:\TEST
Is there a trick to make it work in any folder including C: Program files (86)?
Webview2 0.9.538 prerelease
Canary Version 85.0.554.0
VS2019 Framework 4.62
C# or VB Winforms
target CPU platform x86
AB#30555792
The text was updated successfully, but these errors were encountered: