gpt4 book ai didi

cefsharp - 如何包含 CEFSharp 所需的 VC++ 可再发行文件

转载 作者:行者123 更新时间:2023-12-03 15:56:34 25 4
gpt4 key购买 nike

使用 CEFSharp 浏览器构建应用程序,在我的机器上运行良好,但在服务器上崩溃并出现以下错误:

System.IO.FileLoadException:无法加载由“CefSharp.Core.dll”导入的过程。

我在互联网上看到过这个问题,最常见的解决方案似乎是安装 VC++ Redistributable。但是,我在我们的生产服务器上没有该访问权限。在开发服务器中,我尝试安装可再发行组件(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 并且我的机器上没有任何这些目录。

附加信息:

  • 开发机Windows 10, server 2016 Standard
  • build设置为 x86,未对任何 CPU 模式进行任何配置更改
  • Windows 窗体应用程序
  • 来自 NuGet 的 CefSharp 71.0.0 版(以及单独通过包管理控制台 Simple CefSharp application is missing files at runtime)
  • 不使用任何类型的包或 ClickOnce 部署,手动
    将所有文件从我的电脑上传到服务器

  • 更新:

    虽然我仍然无法让 CEFSharp 在我的项目中工作,但我接受了 Peter Liapin 的回答,因为它确实回答了我提出的问题。现在我知道 VC++ Redistributable 中的哪些文件要复制到服务器上的应用程序文件夹中,我只是在我的计算机或服务器上没有他提到的特定 dll。

    此外,我使用 CEFSharp 创建了一个新的测试 Windows 窗体项目,它在没有 VC++ Redistributable dll 的服务器上运行。但是,我需要 CEFSharp 浏览器在现有应用程序引用的用户控件中工作。

    最佳答案

    您需要随基于 CefSharp 的项目一起提供的 Visual C++ dll:

    如果您使用 CefSharp v63.0.3 或更低版本:

  • msvcp120.dll
  • msvcr120.dll

  • 如果您使用 CefSharp v65.0.0 或更高版本:
    #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

    可以在您的开发 PC 上的以下位置找到文件:
  • C:\Windows\System32
  • C:\Program Files (x86)\Microsoft Visual Studio\[Version]\[Edition]\VC\Redist\MSVC\[Version]\[x64|x86]\Microsoft.VC14x.CRT文件夹。
  • 如果您在机器上查找文件时遇到问题,请参阅底部的部分,VS2015 的文件夹结构略有不同。与 VS2017/2019 相比

  • 请注意,您必须在您的 PC 上安装适当版本的 Visual C++ 或 Visual Studio,否则您将无法找到它们:
  • 版本 120 与 C++ Redistributable for Visual Studio2013 一起安装
  • 版本 140 与 Visual C++ Redistributable for VisualStudio2015 一起安装
  • 版本 141 与 Microsoft Visual C++ Redistributablefor Visual Studio2017 一起安装

  • 通用 CRT Visual C++ 要求, 在 Windows 10它是默认安装的。本地部署 Universal CRT支持见 https://docs.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=vs-2019#local-deployment

    对于 Windows 7/8/8.1,您将需要 Universal CRT按照上面的链接预先安装或部署文件。

    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.



    根据 https://docs.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=vs-2019 VS2015 的位置与 VS2017/2019 略有不同.

    关于cefsharp - 如何包含 CEFSharp 所需的 VC++ 可再发行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54755445/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com