Failed to launch a customized dll that has WebView2 on it on WinForms #3928
Replies: 2 comments
-
Hey @brettlincalgary - thanks for the question. To verify the loader isn't the issue, if you manually add the loader dll to your project folder does that fix it? |
Beta Was this translation helpful? Give feedback.
-
Thanks champnic. If I manually copy WebView2Loader.dll to ATest->bin->Debug folder together with A.dll, it works. However there is still a problem. When I release the A.dll, I can create a msi file which installs A.dll together with WebView2Loader.dll into When the users add A.dll into the Visual Studio toolbar from ATest project, and drag its control to a Form, only A.dll will be automatically added to the Reference and Plus, it looks to me that WebView2Loader.dll is a c++ dll which cannot be embedded into my A.dll which is a C# dll. Is there any way to make the WebView2Loader.dll the dependency of A.dll so that when the control inside A.dll got dragged to a Form, both Thanks again. |
Beta Was this translation helpful? Give feedback.
-
I have a WinForms User Control that has WebView2 on it. Let's call it A control and A.dll. And I have a WinForms Test App let's call it ATest, which will use A Control from A.dll.
I need to add A as a reference to ATest.
Everything works fines if I add A as a project reference. A.dll can be added on the Visual Studio Toolbox and A.dll can be launched and run successfully from ATest.
However, if I add A.dll as an individual dll reference, it can not be launched because the instance of WebView2.CoreWebView2 is always null. I googled a lot and it looks like the WebView2Loader.dll is not loaded.
However, I have installed Edge run time by installing the evergreen and I even tried to statically link the WebView2Loader.dll following this link: https://docs.microsoft.com/en-us/microsoft-edge/webview2/how-to/static
But the problem remains.
I am using WebView2 1.0.1054.31 on .Net 4.7 framework. I tried both Visual Studio 2017, 2019 and 2022. The same problem.
I need to release A.dll which means that it has to be added as a DLL reference, not a project reference.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions