CefSharp使用记录

webbrowser的诟病做开发的都知道,这次的发开项目中我就直接使用了CefSharp组件,过程也是一波三折,遇到很多问题,现在这块基本没什么问题了,过来做下记录。

1.下载地址:https://github.com/cefsharp/CefSharp/

2.之前一直用的vs2010,办公机器懒得折腾一直没装新版vs,无奈打不开这个程序,安装了vs2015 专业版

3.源码调试运行都很顺利

4.项目引用,开发环境基本也没什么大问题。

5.组件引用后,发现关闭程序时出现卡死,后来在FormClosed事件里各种资源释放还是无解,最后研究了下程序退出的各种方法,把Environment.Exit(0);换成Application.Exit();居然完美解决?! 还是不太懂原理,现在依然觉得好神奇。。。。有大神看到的话还请不吝指教~~

6.后来发布的时候的发现在别人的机器上无法运行,提示报错:

System.IO.FileNotFoundException: Could not load file or assembly ‘CefSharp.Core.dll‘ or one of its dependencies. 找不到指定的模块。
File name: ‘CefSharp.Core.dll‘

百度了一下,万幸找到官网帮助:

https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#Runtime_dependencies

引用第4个高频问题如下:

4. Why do I get an error about "Could not load file or assembly ‘CefSharp.Core.dll‘ or one of its dependencies. The specified module could not be found." when trying to run my CefSharp-based application? It compiles successfully, but does not run? It runs on my developer machine, though throws an exception when I copy it to another computer?

This is a common error, typically one of the following

  1. VC++ 2012/2013 Redistributable Package is required in order to run CefSharp on non developer machines. See FAQ #6 below for more information. You can include the required dlls as part of your application.
  2. Not all dependencies are present in the executing folder. CefSharp includes unmanaged dll‘s and resources, these are copied to the executing folder via two .props file which are included in your project when you install the Nuget packages. See list of required files below, make sure the required files are present.
  3. You packaged your application for distribution via an installer and it doesn‘t run on the target machine. Installers don‘t include the unmanaged resources by default, you‘ll need to add them manually. For ClickOnce, see #1314 for some pointers and solutions other users have come up with.
  • 可以先先检查下必要文件是否缺失,下面链接可以查看,如果文件没有问题,查看是否没有安装相应VC++组件。之前一直被一些文章误导说要安装与你vs版本相同的vc++插件版本,于是先安装了VC++2015,依然报错,然后按别人的提示也安装了VC++2012,依然报错,后来看到这个解答才知道我的CefSharp用的是47版本,只需安装VC++2013版本就好了,后来问题完美解决。

A list of required files can be found here: Output files description (Redistribution)

NOTE: This also applies if you get a FileNotFoundException when initializing the WPF control in XAML.

NOTE 2: If compiling from source (not recommended, use the Nuget packages) and you notice that you can no longer build in debug mode, but release builds work just fine you may need to repair your version of Visual Studio. This happens in rare cases where you will get the same exact message as a missing unmanaged .dll file as shown above.

https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution)

Visual C++

For versions 43 and above you will need Visual C++ Redistributable Packages for Visual Studio 2013

For versions 41 and below you will need Visual C++ Redistributable for Visual Studio 2012 Update 4.

VC++ is distributed in both x86 and x64 variants, make sure you install the version matching your target architecture. (i.e. when targeting x86, x86 redistributable packages are needed).

时间: 2024-08-04 10:14:51

CefSharp使用记录的相关文章

CefSharp .net

构建基于Chromium的应用程序 chromium是google chrome浏览器所采用的内核,最开始由苹果的webkit发展而出,由于webkit在发展上存在分歧,而google希望在开发上有更大的自由 度,2013年google决定自己开发webcore的分支,叫做Blink引擎,而后google以BSD伯克利许可开源,BSD许可限制较为宽松, 很多浏览器都是基于chromium开发的,比如,此后省略100字.google在原有基础上做了进一步的精简优化,并开发出v8 javascrip

CozyRSS开发记录17-Html2Xaml

CozyRSS开发记录17-Html2Xaml 1.RssContentView还需要优化 上回做了RssContentView的显示,但是对于rss返回的描述(摘要),连换行的没有,更别说里面还有html描述符了.换行比较好解决,加个限定大小,再加一个自动换行的描述就可以了: TextWrapping="Wrap"  Margin="10 12 10 10" 2.在wpf里显示html的方法 显示html,有两个方向: A.直接显示html B.将html转换成别

C#Winform使用CefSharp将WebBowser控件替换为Chrome内核

先废话一段 ,好久没写博客了,也是跟环境工作有关,之前做技术,天天博客园的翻着 (还是喜欢博客园,因为大家都无私分享交流啊,不像CSDN啥东西都要积分,鄙视之),现在偶尔需要个什么东西了才打开VS写写,刚一上来,看到以前关注的朋友还有坚持写博客的 ,以前还时不时的记录下心情想法,现在也没那个兴趣了,7年改变一个人,看来是吧,回归主题~ 公司参加某信息展会,需要把几个网站系统类似PPT轮播一样在一个屏幕展示出来,找不到解决方案,然后我就试着揽下了这个任务,先想到用winform的webbrowse

老男孩Linux运维第41期20170917开班第四周学习重点课堂记录

第1章 必知必会文件 配置文件位置 该文件作用 /etc/sysconfig/network-scripts/ifcfg-eth0 第一块网卡的配置文件 同setup中的network /etc/resolv.conf 客户端DNS配置文件,优先级低于网卡配置文件 /etc/hosts 主要作用是定义IP地址和主机名的映射关系(域名解析),是一个映射IP地址和主机名的规定 /etc/sysconfig/network 用于配置hostname和networking /etc/fstab 开机自动

SSISDB8:查看SSISDB记录Package执行的消息

在执行Package时,SSISDB都会创建唯一的OperationID 和 ExecutionID,标识对package执行的操作和执行实例(Execution Instance),并记录operation message,统计executable的执行时间,便于developers 优化package的设计,对package进行故障排除. 一,在package发生错误时,查看失败的Executable An executable is a task or container that you

使用插件bootstrap-table实现表格记录的查询、分页、排序等处理

在业务系统开发中,对表格记录的查询.分页.排序等处理是非常常见的,在Web开发中,可以采用很多功能强大的插件来满足要求,且能极大的提高开发效率,本随笔介绍这个bootstrap-table是一款非常有名的开源表格插件,在很多项目中广泛的应用.Bootstrap-table插件提供了非常丰富的属性设置,可以实现查询.分页.排序.复选框.设置显示列.Card view视图.主从表显示.合并列.国际化处理等处理功能,而且该插件同时也提供了一些不错的扩展功能,如移动行.移动列位置等一些特殊的功能,插件可

Git 使用记录

在win7平台已经安装好了git的情况下: 1,Git 本地仓库建立与使用步骤: (2)新建立文件夹: $ mkdir learngit $ cd learngit $ pwd /Users/michael/learngit (1)引入git: 通过git init命令把这个目录变成Git可以管理的仓库: $ git init Initialized empty Git repository in /Users/michael/learngit/.git/ (3)添加文件:git add fil

前端学HTTP之日志记录

前面的话 几乎所有的服务器和代理都会记录下它们所处理的HTTP事务摘要.这么做出于一系列的原因:跟踪使用情况.安全性.计费.错误检测等等.本文将谥介绍日志记录 记录内容 大多数情况下,日志的记录出于两种原因:査找服务器或代理中存在的问题(比如,哪些请求失败了),或者是生成Web站点访问方式的统计信息.统计数据对市场营销.计费和容量规划(比如,决定是否需要增加服务器或带宽)都非常有用 可以把一个HTTP事务中所有的首部都记录下来,但对每天要处理数百万个事务的服务器和代理来说,这些数据的体积超大,很

ClientDataSet中动态添加计算字段并用计算字段显示记录的UpdateStatus

ClientDataSet中每条记录都有UpdateStatus=(usUnmodified, usModified, usInserted, usDeleted)记录该条数据是修改的,删除的,还是新增的等.有时候我们只想看修改的或新增的或删除的就可能用到这一属性.下图用计算字段显示UpdateStatus状态. ********************************************************************************************