zl程序教程

您现在的位置是:首页 >  其他

当前栏目

[无依赖发布webview2程序] 固定版本运行时环境的方式来实现加载网页

2023-04-18 15:03:13 时间

下载固定版本,解压到例如 c:wb2 目录

https://developer.microsoft.com/zh-cn/microsoft-edge/webview2/#download-section

这里翻译有问题,其实是固定版本(Fixed), 194MB.

winform或者wpf

//设置web用户文件夹 
var browserExecutableFolder =   "c:\wb2";
webView.CreationProperties = new Microsoft.Web.WebView2.Wpf.CoreWebView2CreationProperties()
{
    BrowserExecutableFolder = browserExecutableFolder 
};

测试工程源码

https://github.com/densen2014/BlazorMaui/tree/master/Wpf7WithWebview2

https://github.com/densen2014/BlazorMaui/tree/master/WpfWithWebview2

延申 Blazor winform

网友 LINE 研究结果:

要在 OnContentRendered 执行