-
Notifications
You must be signed in to change notification settings - Fork 55
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
Could not add the 'Microsoft.Web.WebView2 0.8.230, a reference in C# windows application. #46
Comments
Thanks for trying out our SDK! Unfortunately, the scenario you describe is not currently supported. We're working on .NET support (see #23). We do have a TLB file in the nuget package. The closest you can get currently is to use tlbimp.exe on the TLB to generate a DLL you can use in .NET. But that won't have support for WPF or WinForms. This is what we're working on building. |
How much duration will it take to provide support for WebView2 in .NET WPF or WinForms application. |
It is a feature we are planning but I'm not sure when we'll finish yet. |
Hi David, |
Apologies, no update on dates yet. You could potentially use tlbimp on the tlb from the nuget package. The tlbimp generated DLL can be used to interact with the values returned from the WebView2Loader.dll CreateWebView2Environment method. But you'd likely need to make your own C# wrapper around all that to make a useful sort of WebView2 .NET control. It is doable but will be some work. This is essentially what we'll be working on to support WebView2 in .NET. |
Hi David, |
Not sure offhand. I would have thought that CreateWebView should take a IntPtr as the first param for its .NET method. Perhaps this StackOverflow conversation helps. |
That's what I expect too, however the CreateWebView method generated by tlbimp has this _RemotableHandle as the first parameter. |
Hello everyone, I find the WebView2 control very useful. Already successfully tested with the example WebView2Sample. Is it possible to create a WebView2 control for UWP? I have created an Interop.WebView2.dll from WebView2.tbl via tlbimp. I referenced the Interop.WebView2.dll in UWP and added the Microsoft.Web.WebView2 0.8.230 package via nuget. Then I created a WebView2 class on UWP that inherits from FrameworkElement and implements IWebView2WebView, IWebView2WebView2, IWebView2WebView3, IWebView2WebView4 Now I have to implement the methods. I tried to define for example the "Navigate" method as follows: [DllImport ("WebView2Loader.dll", EntryPoint = "Navigate")] But at runtime I get the error "System.DllNotFoundException: 'Unable to load DLL 'C:......\bin\x64\Debug\WebView2Loader.dll': Accesso negato. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" Some idea? |
WebView2Loader.dll doesn't exposes Navigate as as a method you can p/invoke. You need to create the WebView2 environment, then WebView2 browser then you can navigate. Creating the environment is p/invoke and the rest is COM interop. You can check out some working interop code at WebView2 Interop the nuget package is here There is a .net version of the browser sample that uses the interop at DotNetBrowser sample Maybe some of that code will help. |
Thanks Michael for your reply. I saw your examples and I tested WebView2 Windows Forms control which works very well. I would like to implement a WebView2 Control for a UWP but I can't do p/Invoke on WebView2Loaderdll to create the environment. I always get an "E_ACCESSDENIED" to the DLL. Are there any limitations on the Universal Windows Platform? |
We plan to support a XAML version of WebView2 that can work in UWP apps. But yes there are limitations on UWP apps that may not work well with our current WebView2Loader. |
I have the urgency to create in a few days a WebView 2 control for a UWP or any alternative solution that allows me to be able to use Edge-Chromium or Chome from a UWP. Those interested can contact me privately, we agree to consult. Thank you all |
I'm currently using WebView in my .Net Application which emulates Microsoft Edge. When the update rolls out on Jan 15th 2020, Will Edge chromium replaces Microsoft Edge? If that's the case, it will be a problem for our users since we have no access to WebView2 .Net. I am little disappointed on how Microsoft left .Net behind when it comes to edge chromium. We could have contributed so much by testing it. And now the update is rolling out and yet there is no time frame on when .Net will be included. That's a set back for every company using .NET |
hey @markismail7 , as far as I know on January 15th the first Stable build for Edge will be available for download, and we'll roll it out to Consumer soon after. The EdgeHTML Edge browser is getting replaced by Chromium Edge when this happens, but the actual EdgeHTML platform is still on users' machine s.t. stuff like WWA doesn't stop working. In terms of .NET, I hear ya. It's on our roadmap for WebView2 and we're definitely not leaving .NET developers behind. It's just that the .NET support will be based on our Win32 C++ control, so from a topological order, we need to get Win32 C++ first. Don't worry, it's on the way! Internally, we're figuring out when we can get a .NET preview out for developers to test on. |
Will the Chromium Edge control support accessing the DOM tree using e.g. GetElementById as in the .Net IE WebBrowser control? |
// let's open another issue if we are going talk about this extensively Currently not planning to add native methods for DOM manipulation but you can do the same through calling scripts. Would that work for you? |
Thanks for the reply. We just need a date on when .net will be included, so we can get ready. I'm tired of using Google Chrome. Nothing against google, but i love Microsoft. The reason we needed google |
Haha I love the passion in your reply @markismail7 . We're currently targeting this March for a .NET preview. We (and I personally) really want to get this out ASAP but I do want to say though that there are other factors and work that can end up affecting our .NET scheduling. |
I've been successfully been able to use WebView2 0.8.355 in a .Net Standard C# WPF Project. I can't get it to do much, but this will work. |
@JNORMANAZ Can you use invoke script? I need webview2 so bad in my project. I've been testing Edge Chrome. Microsoft finally did it. It not just meet Google Chrome, actually it exceeds it. |
You can give this a try while you're waiting for the real .net WebView2 from Microsoft. .net WebView2 |
@markismail7 I got as far as navigating! |
@markismail7 Yes, I could. BrowserWindowOne.NavigateToString("<script>alert('Hello world!');window.location.assign('https://www.microsoft.com');</script>"); |
@michael-russin We may give it a try, thank you. |
@michael-russin I have latest Edge Chromium installed (79.0.309.71). When I run WebView2.Wpf.Sample project, get the following exception. Any idea what might be causing this? System.InvalidCastException: 'Unable to cast COM object of type 'System.__ComObject' to interface type 'MtrDev.WebView2.Interop.IWebView2Environment3'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D82C6A26-370F-4084-8149-C08FF1598C9B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).' |
Thanks for taking a look at the sample. That sample uses Microsoft.Web.WebView2.0.8.355 which requires Edge Chromium 80. Try installing the beta version of Edge Chromium. Also please post any other questions to webview2-control |
Hi, |
Hi @ventodev93,
|
Hi @pagoe-msft,
Many Thanks in Advance for your Reply! |
will there be preview for UWP in March? |
Our UWP project is on hold because the old UWP Webview is 10 years behind Android and iOS/macOS. We cannot move further and are waiting for UWP Webview2. It is sad that MS decided to move backward with win32 instead of moving forward like the other companies. We are now telling our customers to move to Apple products if they cannot wait a year or more until MS provide the modern tools for modern applications. MS focusing on Win32 is telling the world : Our operating system will never be secure (sanboxed). Our MS port will only have half of the features of our Android, iOS/macOS app. There is not even proper PDF viewer or PDF tools included in the MS SDK (the other os SDK do provide these features natively). So our Windows version will cost us thousands of dollars every year (for expensive pdf libs) just so we can provide basic PDF functionality like the other platforms. |
I definitely wish that Microsoft would get this new viewer control to .NET developers and also make its pdf capabilities available in the same control. I use the new Edge for both web content and PDF content including filling and signing PDFs and it would be great to have that all directly available from Microsoft "out of the box" so to speak for our .NET applications as well. Hope we hear good news about a preview version soon. |
@applefanbois Shipping WebView2 on UWP is very important to us. You can checkout the alpha release here: https://docs.microsoft.com/en-us/uwp/toolkits/winui3/ @wjvii Stay tuned, we will have a WebView2 .NET Preview out soon! |
@pagoe-msft it seems that WinUI3 means, that whole UWP app needs to be ported use WinUI3 Xaml components (as mixing of UWP and WinUI3 Xaml components is not supported). Are you planning to have any other paths to use WebView2 for existing UWP apps? |
@pagoe-msft, very exciting, looking forward to it! One thing I ran into yesterday was the need to be able to download or at least control the download of a file from a link in the page currently shown in the Webview, which I cannot do with the current Webview, or at least could not figure out how to. It appears the old Webbrowser control did allow you to hook into the download file event if I read some of the articles correctly. Will the new WebView2 control allow me to programmatically download a file or at least hook into the event when a file is being downloaded in the browser control? I have a scenario where I need to start that in a database vs a file on disk so that would be highly useful to replace the current save to a file and then import separately. |
We are doing that with the current Webview on Android, iOS and Win. but we trigger custom commands from server with javascript. We intercept and inject javascript within the Webview and obey our custom server commands to download and upload files. |
@applefanbois Interesting approach and sounds super flexible. I am not very guru with the javascript or Typescript but some other members of our team are. Not sure this will work for us though because it sounds like you are saying you need access to the server side to create the custom commands, which I cannot do. Did I get that right? |
Yes, the server or the page loaded triggers javascript command that we intercept in our app and respond to it. We have bidirectional communication between the web page and WebView. If you need help, I can send you code. app.webview <-> webpage <-> server. Another way would be to override existing javascript function, for example to detect page name changes. |
Now there is new Webview2 SDK version 0.9.488. That requires Edge 84. I didn't see any mention about WPF. Is It so that Edge 85 is the earliest possible for some preview WPF support? Or still some hope for something in Edge 84? |
All I can say is that it does not work with a pure UWP project. The programmer in charge tried and told me we got an endless list of unsolvable errors. As of now, WebView2 on UWP is just hope. Maybe Microsoft is too busy cooking something special with Marina Abramović? |
Hi everyone, We have released a preview of WebView2 for .NET! Check it out here: |
Is there any .Net Core Getting Started Guide? By the way, in Widows form, CoreWebView2.CapturePreviewAsync has no callback handler parameter to be invoked when CapturePreview finishes writing to the stream. |
I keep getting an error on load: Anyone knows why? |
Could the root cause be #182 |
I tried . It didn't work. here is the error: System.InvalidOperationException: 'An error occurred creating the form. See Exception.InnerException NullReferenceException: Object reference not set to an instance of an object. This exception was originally thrown at this call stack: |
I cannot even build a simple .NET Framework 4.7.2 app with it by installing the nuget package Severity Code Description Project File Line Suppression State
Any particular things I need to do beside install the nuget? |
The .NET WebView2 is first available in 0.9.515-prerelease and works with the latest Edge canary channel browser. Please make sure you're using these and if you're still hitting problems, please open a new issue. Thanks! |
I found it lol for some reason you must change the name property. Change the Name property to webView. And it has to be the canary version. Its really fast. I love it. Can't wait for the production version. |
Hi Everyone, When I tried to add the new webView2 control in VSTO (Word Add-In) project then it is throwing below error. at Microsoft.Web.WebView2.WinForms.WebView2.OnVisibleChanged(EventArgs e) I have used the below configuration. Webview2 library: The .NET WebView2 0.9.515-prerelease |
Hi Everyone, I can't use WebView2 with .net core winform ; is it normal ? (it works with .net core wpf, but it's not what I use...) |
Use NuGet package version 0.9.538-prerelease. |
Microsoft: It has been 30 days and we still stuck with the pre-release Webview2 for windows form. We have businesses to run. Release the production version already. Thanks. |
Same here our app is ready on iOS, macOS, Android... but we are stuck on Windows. We are warning our windows users that they won't get a newer version before another year. We tell them to buy Apple product if they want our latest features. |
Hey folks. To set the expectation, the .NET WebView2 is targeted for EoY. There are still some major blockers until we can GA this, e.g.
https://docs.microsoft.com/en-us/microsoft-edge/webview2/roadmap |
I have created the C# windows application and install Microsoft.Web.WebView2 0.8.230 dll.
The dll is installed successfully but I haven't found dll in project references.
so I have browser the dll and try to add the dll project but that dll is not added in to project?
please give me some referral answers for this issue.
The text was updated successfully, but these errors were encountered: