当咱们为基于 .NET Framework 的 WinForm 程序增长 CefSharp.WinForms 依赖后,可能会遇到如下报错信息:html
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 CefSharpDemogit
CefSharp.Common.targets
咱们能够经过“配置管理器”为项目设置具体的 x86 或 x64 目标平台来消除该报错,同时咱们也能够经过一些设置让咱们的程序同时支持 x86 和 x64 目标平台。本篇将简述如何为依赖来 CefSharp.WinForms 的程序启用 AnyCPU 支持。github