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         }

    编译运行,成功。

  • 相关阅读:
    联考20200520 T2 函数
    联考20200520 T1 石子游戏
    模拟赛T2 中继系统
    模拟赛T2 仙人掌毒题
    BZOJ3462 DZY Loves Math II
    20200129模拟赛T1 string
    BZOJ1316 树上的询问
    BZOJ4559 成绩比较
    JZOJ4238 纪念碑
    BZOJ 2648 世界树
  • 原文地址:https://www.cnblogs.com/fengbol/p/8806138.html
Copyright © 2011-2022 走看看