英文:
msi with C#-webview2 does not work with webview
问题
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");
}
}
}
我是一名刚开始学习C#的学生。
如果您按照上面的代码编写并使用ClickOnce发布,
WebView将正常工作。
然而,如果您将其制作为MSI文件,WebView将无法正常工作。
您能帮助我了解需要采取哪些措施吗?
英文:
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?
答案1
得分: 0
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
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论