當我們為基於 .NET Framework 的 WinForm 程序增加 CefSharp.WinForms 依賴后,可能會遇到以下報錯信息:
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 CefSharpDemo
CefSharp.Common.targets
我們可以通過“配置管理器”為項目設置具體的 x86 或 x64 目標平台來消除該報錯,同時我們也可以通過一些設置讓我們的程序同時支持 x86 和 x64 目標平台。本篇將簡述如何為依賴來 CefSharp.WinForms 的程序啟用 AnyCPU 支持。