I have a C# Class Library that is using the 4.8 .Net Framework, within that I have a Windows Form that I want to use the WebView2 control on. When I add the latest stable version (1.0.2651.64) via NuGet, this includes the following:
- Microsoft.Web.WebView2.Core
- Microsoft.Web.WebView2.WinForms
- Microsoft.Web.WebView2.Wpf
I can add the WebView2 control to the form and interact as required.
However when I save the Project and close it, then re-open it I get 4 missing references:
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\build..\lib_manual\net6.0-windows10.0.17763.0\Microsoft.Web.WebView2.Core.Projection.dll
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\build..\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\build..\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.WinForms.dll
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\build..\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll
I can't figure why these references would be needed when I have correct References to:
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\lib\net462\Microsoft.Web.WebView2.Core.dll
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\lib\net462\Microsoft.Web.WebView2.WinForms.dll
- C:\Safe\ClassLibrary1\packages\Microsoft.Web.WebView2.1.0.2651.64\lib\net462\Microsoft.Web.WebView2.Wpf.dll
I've deleted the missing references, re-compiled, no issues, save it, no problems. Closed the Project, then re-open and the missing references re-appear.
I've tried creating projects under mapped drives, also on my C drive and under C:\Users\ and all with the same problem.
I'm using VS2022 and running as Admin.
Any suggestions?