C# and WebView2

%3CLINGO-SUB%20id%3D%22lingo-sub-1652000%22%20slang%3D%22en-US%22%3EC%23%20and%20WebView2%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1652000%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3Ehas%20anybody%20tried%20this%20example%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoft-edge%2Fwebview2%2Fgettingstarted%2Fwinforms%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoft-edge%2Fwebview2%2Fgettingstarted%2Fwinforms%3C%2FA%3E%3C%2FP%3E%3CP%3E%3F%3C%2FP%3E%3CP%3EI%20do%20not%20see%20control%20in%20Toolbox%20and%20also%20get%20%22WebView2%20could%20not%20be%20found%20(are%20you%20missing%20a%20using%20directive%20or%20an%20assembly%20reference%3F)%22%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20using%3A%3C%2FP%3E%3CUL%3E%3CLI%3EVisual%20Studio%20Community%202019%2C%26nbsp%3Bv.16.7.3%3C%2FLI%3E%3CLI%3E.NET%20Framework%204.7.2%3C%2FLI%3E%3CLI%3EC%23%20%2B%20WinForms%3C%2FLI%3E%3CLI%3EMicrosoft.Web.WebView2%2C%20v.0.9.579%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22c01192%22%3EMicrosoft%20Edge%2C%20v.%3C%2FSPAN%3E%3CSPAN%20class%3D%22c01193%22%3E87.0.635.0%20canary%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EI%20also%20found%20this%3A%3C%2FP%3E%3CP%3E%22This%20package%20is%20necessary%20for%20Win%2032%20C%2FC%2B%2B%20applications.%22%3C%2FP%3E%3CP%3Ein%20NuGet%20description.%20Does%20it%20work%20with%20C%23%3F%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi everyone,

has anybody tried this example

https://docs.microsoft.com/en-us/microsoft-edge/webview2/gettingstarted/winforms

?

I do not see control in Toolbox and also get "WebView2 could not be found (are you missing a using directive or an assembly reference?)" error.

 

I'm using:

  • Visual Studio Community 2019, v.16.7.3
  • .NET Framework 4.7.2
  • C# + WinForms
  • Microsoft.Web.WebView2, v.0.9.579
  • Microsoft Edge, v.87.0.635.0 canary

I also found this:

"This package is necessary for Win 32 C/C++ applications."

in NuGet description. Does it work with C#?

Thank you.

1 Reply
Highlighted

I think, I found solution: update to a pre-release version.

Write In Package Manager Console

PM> Update-Package Microsoft.Web.WebView2 -Version 0.9.579-prerelease

and restart Visual Studio.