zoukankan      html  css  js  c++  java
  • cefsharp 在anycpu下运行

    从cefsharp57开始就支持anycpu了,不过需要一些设置:

    1.首先要打开*.csprj文件,添加节点 <CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>

    <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        ...
        <CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
      </PropertyGroup>

    2.修改app.config文件

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
        </startup>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="x86"/>
        </assemblyBinding>
      </runtime>
    </configuration>

    3.最后在App.xaml.cs的构造函数里添加:

     1  [MethodImpl(MethodImplOptions.NoInlining)]
     2         private static void CefInit()
     3         {
     4             CefSharp.CefSettings settings = new CefSharp.CefSettings();
     5             ...
     6             settings.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
     7                 Environment.Is64BitOperatingSystem ? "x64" : "x86",
     8                 "CefSharp.BrowserSubprocess.exe");
     9             CefSharp.Cef.Initialize(settings, false, null);
    10         }

    编译运行,成功。

  • 相关阅读:
    SimpleCursorAdapter的使用
    sizeof和strlen的区别和联系总结
    设计模式-工厂方法模式
    Python第四章-字典
    Python第四章-字典
    Python第三章-字符串
    Python第三章-字符串
    Python 第二章-列表和元组
    Python 第二章-列表和元组
    设计模式-简单工厂模式
  • 原文地址:https://www.cnblogs.com/fengbol/p/8806138.html
Copyright © 2011-2022 走看看