我用的是VS2019,正常用Nuget安装了CefSharp.winfroms和他的依赖。调试也没问题,本地跑通了,但是一打包发布后,安装完打开就报错。打包发布后就报错未能加载文件或程序集“CefSharp.Core.Runtime.dll”或它的某一个依赖项。找不到指定的模块。 文件名:“CefSharp.Core.Runtime.dll”?在网上看了很多资料,说是没安装Visual C++ ,但是我看了看是安装了的,实在是找不到哪里出了问题,大神帮我看看。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using CefSharp.Core;
using CefSharp.WinForms;
//using CefSharp.Wpf;
namespace WindowsFormsApp1
{
public partial class Main : Form
{
public ChromiumWebBrowser chromeBrowser;
public Main(string a_url)
{
InitializeComponent();
InitializeChromium(a_url);
}
private void Main_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}
//初始化浏览器并启动
public void InitializeChromium(string a_url)
{
CefSettings settings = new CefSettings();
string url1 = "http://192.168.10.189:8082/?";
string url = url1 + a_url;
chromeBrowser = new ChromiumWebBrowser(url1);
this.Controls.Add(chromeBrowser);
chromeBrowser.Dock = DockStyle.Fill;
}
//窗体关闭时,记得停止浏览器
private void Main_Closing(object sender, FormClosingEventArgs e)
{
CefSharp.Cef.Shutdown();
}
}
}