操作方法

操作方法:在加载项中使用 CefSharp 和 ArcGIS Pro SDK ChromiumWebBrowser 控件修复编译器错误

Last Published: September 12, 2023

摘要

After adding references to ArcGIS Pro’s CefSharp assemblies to an add-in and adding a reference to the ArcGIS Pro ChromiumWebBrowser control to the add-in UI xaml, for example, on a pane or dockpane, as shown in the following image, a compiler error is returned stating that the ChromiumWebBrowser control cannot be found in the ArcGIS.Desktop.Framework.Controls namespace in the ArcGIS.Desktop.Framework assembly.

image of added references
image of compiler error
Moreover, additional warning messages may also be returned, and the UI xaml can no longer be viewed in the Visual Studio Designer, as shown below.
image of Visual Studio Designer error

原因

When using CefSharp, to resolve the compiler issue with the Visual Studio designer, the add-in platform target must be set to x64.

过程

  1. Open the Visual Studio Configuration Manager.
image of Visual Studio Configuration Manager
  1. Select <New…> from the Active solution platform list box.
image of configuration manager
  1. From the New Solution Platform dialog box, select x64 and click OK.
image of the New Solution Platform dialog box
  1. Make sure that the Active solution platform and Platform list boxes both show x64 as shown in the image below, and click Close.
image of configuration manager
  1. Re-build the add-in.
Note:
If your control constructor InitializeComponent() call (within your user control .xaml.cs code behind file) throws a System.Windows.Markup.XamlParseException with an inner exception: “FileNotFoundException: CefSettings BrowserSubprocessPath not found.” check the Copy Local setting on your CefSharp assembly references. Copy Local must be set to false.
image of exception

Please consult ProConcepts Framework, ChromiumWebBrowser for more information.

文章 ID:000022628

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容