如何包括CEFSharp所需的VC ++可再发行文件 [英] How to include VC++ Redistributable Files Needed by CEFSharp
问题描述
使用CEFSharp浏览器构建应用程序,可以在我的机器上正常运行,但是在服务器上崩溃并出现以下错误:
System.IO.FileLoadException:一个过程无法加载由 CefSharp.Core.dll导入的文件。
我已经在Internet上看到了此问题,最常见的解决方案似乎是安装VC ++可再发行。但是,我的生产服务器上没有该访问权限。在开发服务器中,我尝试安装可重分发文件(x86,x64、2017和2013),没有任何改变。计算机是64位的,但应用程序是32位的,所以我尝试了所有操作。
有人可以告诉我我需要添加哪些文件才能添加到应用程序目录中,以使CEFSharp正常工作。本文档的第6节: https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#6-how-do-i-include-the- visual-studio-c-2012-redistributables-on-the-target-app 列出了必要的文件目录,但我使用的是Visual Studio 2017,并且我的计算机上没有这些目录。 p>
其他信息:
-
开发机器Windows 10,服务器2016 Standard
-
内部版本设置为x86,未对任何CPU模式进行任何配置更改
-
Windows窗体应用程序
-
NuGet的CefSharp版本71.0.0(&分别通过程序包管理控制台运行中的简单CefSharp应用程序为在运行时丢失文件)
-
不使用任何类型的程序包或ClickOnce部署,请手动将
的所有文件从计算机上载到服务器
更新:
尽管我仍然无法为了让CEFSharp在我的项目中工作,我接受了Peter Liapin的回答,因为它确实回答了我提出的问题。现在,我知道了VC ++ Redistributable中的哪些文件将复制到服务器上的应用程序文件夹中,只是我在计算机或服务器上没有他提到的特定dll。
此外,我使用CEFSharp创建了一个新的测试Windows窗体项目,该项目可在没有VC ++可再发行的dll的服务器上运行。但是,我需要CEFSharp浏览器才能在现有应用程序引用的用户控件中工作。
您需要的Visual C ++ dll随基于CefSharp的项目一起提供:
如果您使用CefSharp v63.0.3或更低版本:
- msvcp120.dll
- msvcr120.dll
如果您使用的是CefSharp v65。 0.0或更高版本:
#VC ++ 2017的文件示例(141),VC ++的文件较少2015(140)和VC ++ 2019(142)的更多内容,请复制Microsoft.VC14x.CRT文件夹中的所有内容,其中x与VC ++版本相匹配
concrt140.dll
msvcp140.dll
msvcp140_1.dll
msvcp140_2.dll
vccorlib140.dll
vcruntime140.dll
文件可在您的Dev PC上的以下位置找到:
-
C:\Windows \System32
-
C:\程序文件(x86)\Microsoft Visual Studio\ [版本] \ [版本] \VC\ \Redist\MSVC\ [版本] \ [x64 | x86] \Microsoft.VC14x.CRT
文件夹。 - 如果在查找计算机上的文件时遇到问题,请参见底部部分,与
VS2015
相比,它们的文件夹结构略有不同到VS2017 / 2019
注意,您必须具有适当版本的Visual在您的PC上安装了C ++或Visual Studio,否则您将找不到它们:
-
版本120随< a href = https://www.microsoft.com/zh-cn/download/details.aspx?id=40784 rel = nofollow noreferrer> Visual Studio
2013的C ++可重新分发 -
版本140与可用于Visual
Studio
2015 的Visual C ++可重新分发
通用CRT 是必需的由 Visual C ++
发行,在 Windows 10
上默认安装。支持 Universal CRT
的本地部署,请参见 https://docs.microsoft.com/zh-cn/cpp/windows/universal-crt-deployment?view=vs-2019#local-部署
对于Windows 7/8 / 8.1,您需要预先安装 Universal CRT
或
要部署可再发行的Visual C ++文件,可以使用Visual C ++
可再发行软件包(VCRedist_x86.exe,VCRedist_x64.exe或
VCRedist_arm.exe)包含在Visual Studio中。在Visual Studio
2017中,可以在程序文件[(x86)] xMicrosoft
Visual Studio\2017\版本\VC\Redist\MSVC\lib中找到这些文件-version文件夹,其中
版本是安装的Visual Studio版本,而lib-version是要重新分发的库的
版本。在Visual Studio 2015中,可以在
程序文件[(x86)] [Microsoft Visual Studio
版本\VC\redist\的Visual Studio安装目录下找到这些
文件。语言环境。另一个选择是使用可重新分发的
合并模块(.msm文件),可以在Visual Studio 2017中的程序文件[(x86)] \Microsoft Visual
Studio\中找到
。 2017年版本VC中Redist的MSVC lib版本合并模块文件夹。
在Visual Studio 2015中,可以在程序文件
[(x86)] \公共文件\合并模块中找到这些文件。也可以直接
在应用程序本地
文件夹中安装可再发行的Visual C ++ DLL,该文件夹包含可执行应用程序
文件。出于维修原因,我们不建议您使用
的安装位置。
根据 https://docs.microsoft.com/zh- us / cpp / windows / redistributing-visual-cpp-files?view = vs-2019 VS2015
的位置与略有不同VS2017 / 2019
。
Building an application using the CEFSharp browser, works fine on my machine, but crashes on the server with the following error:
System.IO.FileLoadException: A procedure imported by 'CefSharp.Core.dll' could not be loaded.
I’ve seen this problem all over the internet, and the most common solution seems to be installing the VC++ Redistributable. However, I don’t have that access on our production server. In the development server, I tried installing the redistrituable (x86, x64, 2017, and 2013) and nothing made a difference. The computers are 64 bit, but the application is 32bit so I tried everything.
Can someone tell me what files specifically I need to add to the application directory to make CEFSharp work. Section 6 of this document: https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#6-how-do-i-include-the-visual-studio-c-2012-redistributables-on-the-target-app lists directories of files necessary, but I’m using Visual Studio 2017 and don’t have any of these directories on my machine.
Additional Info:
Development machine Windows 10, server 2016 Standard
Build set to x86, have not made any config changes for Any CPU mode
Windows Forms application
CefSharp version 71.0.0 from NuGet (& individually through Package Management Console Simple CefSharp application is missing files at runtime)
Not using any type of package or ClickOnce Deployment, manually uploading all files from my computer to server
Update:
Although I'm still unable to get CEFSharp to work in my project, I accepted Peter Liapin's answer because it did answer the question I asked. Now I know what files in the VC++ Redistributable to copy to my application folder on the server, I just don't have the specific dlls he mentioned on my computer or on the server.
Additionally, I created a new test Windows forms project with CEFSharp and it worked on the server without the VC++ Redistributable dlls. However, I need the CEFSharp browser to work in a user control referenced by existing application.
The Visual C++ dlls you need to ship with your CefSharp based project:
If you use CefSharp v63.0.3 or below:
- msvcp120.dll
- msvcr120.dll
If you use CefSharp v65.0.0 or above:
#Example of files for VC++ 2017(141), there will be a few less files for VC++2015(140) and a few more for VC++ 2019(142), copy everything from the `Microsoft.VC14x.CRT` folder where `x` matches the VC++ Version
concrt140.dll
msvcp140.dll
msvcp140_1.dll
msvcp140_2.dll
vccorlib140.dll
vcruntime140.dll
Files can be found on your Dev PC in the:
C:\Windows\System32
C:\Program Files (x86)\Microsoft Visual Studio\[Version]\[Edition]\VC\Redist\MSVC\[Version]\[x64|x86]\Microsoft.VC14x.CRT
folder.- See section at bottom if you are having problems finding the files on your machine, they are in slightly different folder structure for
VS2015
compared toVS2017/2019
Note, you must have an appropriate version of Visual C++ or Visual Studio installed on your PC, otherwise you would not be able to find them:
Version 120 is installed with C++ Redistributable for Visual Studio 2013
Version 140 is installed with Visual C++ Redistributable for Visual Studio 2015
Version 141 is installed with Microsoft Visual C++ Redistributable for Visual Studio 2017
Universal CRT is required by Visual C++
, on Windows 10
it is installed by default. Local deployment of the Universal CRT
is supported see https://docs.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=vs-2019#local-deployment
For Windows 7/8/8.1 you will either need the Universal CRT
pre installed or deploy the files as per the link above.
To deploy redistributable Visual C++ files, you can use the Visual C++ Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or VCRedist_arm.exe) that are included in Visual Studio. In Visual Studio 2017, these files can be found in the Program Files[ (x86)]\Microsoft Visual Studio\2017\edition\VC\Redist\MSVC\lib-version folder, where edition is the Visual Studio edition installed, and lib-version is the version of the libraries to redistribute. In Visual Studio 2015, these files can be found under your Visual Studio installation directory in Program Files [(x86)]\Microsoft Visual Studio version\VC\redist\locale. Another option is to use redistributable merge modules (.msm files), which in Visual Studio 2017 can be found in the Program Files [(x86)]\Microsoft Visual Studio\2017\edition\VC\Redist\MSVC\lib-version\MergeModules\ folder. In Visual Studio 2015 these can be found in Program Files [(x86)]\Common Files\Merge Modules. It's also possible to directly install redistributable Visual C++ DLLs in the application local folder, which is the folder that contains your executable application file. For servicing reasons, we do not recommend that you use this installation location.
As per https://docs.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=vs-2019 the locations for VS2015
are slightly different to VS2017/2019
.
这篇关于如何包括CEFSharp所需的VC ++可再发行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!