我不怨谁,我只怨这道墙,
我不怨谁,我只怨​Microsoft

一坑接一坑。

cef sharp 官网
https://github.com/cefsharp/cefsharp

1.先安装VC ++ Runtime 2013,如果是用vs2013开发的话。
根据自己的系统下载相应的版本。

这些组件是在未安装 Visual Studio 2013 的计算机上运行使用 Visual Studio 2013 开发的应用程序所必需的。这些软件包安装以下库的运行时组件

安装完成以后显示

2.Nuget安装cefsharp.
通过package manager安装

Install-Package CefSharp.WinForms -Version 79.1.360
安装完以后。packages.config中会出现以下引用。

也可以不安装,直接把下面这段话复制进去 。

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CefSharp.WinForms" version="79.1.360" targetFramework="net45" />
</packages>
3.nuget 说明
经常下载的时候 ,提示下载 不了,或者下载了不能用,

我们需要看下说明 。

比如如下,你要安装cefsharp.winforms时,看下他的依赖。

他下面的dependencis中显示 ,要依赖framework 4.5.2 中的cefsharp.common.

这个时候 如果我们的程序是framwork4.5的话,有时虽然不会提示有错误 ,但是依赖不会下载 ,则还是不能用。

同时即使你调整为 framework4.5.2 ,因为host主机在国外,有时也会被gfw限制,导致无法下载 。

从错误现象分析,在下载cefshap.common时出现操作超时,有可能是网络限制,

首先我们开启下fq功能,然后打开google检测下是否正常 ,如果打开了,就正常 。

然后重新开始下载

可以看到已经正常下载了。 cefsharp.winform,依赖cefsharp.common. 同时cefsharp.common依赖cef.redist.x86. ,cef.redist.x64.

我们可以去cefsharp.common的页面中查看下

再次进行安装时。cefsarp.common安装好了,但是他的依赖不行

说是找不到

nuget.org [https://www.nuget.org/api/v2/] 上的源

一步一坑了。

用浏览器打开

看发现啥东西,那当然找不到了。

这个v2的地址应该不能用 了。

借用搜索引擎找一个可以替换的新地址。

https://nuget.cdn.azure.cn/v3/index.json

选持nuge包管理器

打开以后进行配置 好以后,再次进行安装 。

把以下文件加入hosts

nslookup nuget.org 8.8.8.8
换了几种方案都不行,只能自己下载 的,

自带链接下的慢。

启动自己的玩客云进行下载 。

x64的很快就好了,估计有其它人下过。 x64下载过来以后改成为cef.redist.x64.79.1.36.nupkg

x86有点慢,不过也是半小时左右好了。

然后在自己的e 盘建立一个本地的nugetPackage,把两个下好的nuget包放进去

最后配置 本地源,先从nuget.org上取,取不到的时候 再从本地来取

最后成功 安装

查看packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cef.redist.x64" version="79.1.36" targetFramework="net452" />
<package id="cef.redist.x86" version="79.1.36" targetFramework="net452" />
<package id="CefSharp.Common" version="79.1.360" targetFramework="net452" />
<package id="CefSharp.WinForms" version="79.1.360" />
</packages>
对项目进行编译

错误 2 CefSharp.Common is unable to proceeed as your current Platform is 'AnyCPU'. To target AnyCPU please read https://github.com/cefsharp/CefSharp/issues/1714. Alternatively change your Platform to x86 or x64 and the relevant files will be copied automatically. For details on changing your projects Platform see https://docs.microsoft.com/en-gb/visualstudio/ide/how-to-configure-projects-to-target-platforms?view=vs-2017

要选定平台x64位,或者32位

错误 2 The OutputPath property is not set for project 'xxx.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x64'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.


本文由 hcb 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论