using System;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e)
{
this.webView21.Source = new Uri("https://www.google.com");
}
}
}
I am a student just starting to learn C#. If you simply write the code as above and publish it with (Clickonce) publish, the webview will work normally. However, if you make it as an msi file, the webview does not work. Can you help me with what needs to be done?
A common cause is the WebView2Loader.dll
not being included.
Sometimes it needs to be manually included.
See Distribute your app and the WebView2 Runtime - Files to ship with the app
Also see these discussions of the issue...
Deployed C# app using WebView2 cannot find the Runtime
WebView2Loader.dll is left out when publishing
WebView2Loader.dll is missing from the Installer Folder
WebView2 works in debug but not when published with ClickOnce