Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my winforms application, I used WebBrowser class which is using IE browser. I want to update it into WebView class so that I can use Edge browser. That's why I installed packages Microsoft.Toolkit.Forms.UI.Controls.WebView. Then I changed some existing code which is compatible with WebView. But when I ran the project, I found the below errors after installing that package.

The item "C:Projectswindows-v2packagesSystem.Runtime.WindowsRuntime.4.6.0uild et461.... ef etstandard2.0System.Runtime.WindowsRuntime.dll" in item list "ReferencePath" does not define a value for metadata "CopyLocal". In order to use this metadata, either qualify it by specifying %(ReferencePath.CopyLocal), or ensure that all items in this list define a value for this metadata.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
393 views
Welcome To Ask or Share your Answers For Others

1 Answer

To use a WebViewCompatible control in a Windows Forms application:

  1. Install package Microsoft.Toolkit.Forms.UI.Controls.WebView
  2. Right click on an empty area in Toolbox → select Choose Items → From the Choose Toolbox Items → choose .NET Framework Component tab → Click on Browse → Browse the package folder and choose Microsoft.Toolkit.Forms.UI.Controls.WebView dll → Click Open → Click OK
  3. Drop an instance of WebViewCompatible control on the form.
  4. In the Load event or in constructor after InitializeComponent add code to navigate to the address you want:

    webViewCompatible1.Navigate("https://www.google.com");
    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...