正如标题所示,我要做的是在Excel的VSTO自定义任务窗格(CTP)中嵌入Cefsharp Chromium浏览器。
我已经在标准Windows窗体中测试了Cefsharp浏览器,它运行得很漂亮。我正在使用this代码进行CTP,这也没有问题
当我尝试将它们组合时出现问题。然后我收到一个'System.IO.FileNotFoundException'错误,指出无法读取'CefSharp.Core.DLL'。
我的CTP启动功能就像这样:
Private taskPaneControl1 As TaskPaneControl
Private WithEvents taskPanaValue As CustomTaskPane
Private Sub ThisAddIn_Startup() Handles Me.Startup
taskPaneControl1 = New TaskPaneControl()
taskPanaValue = Me.CustomTaskPanes.Add(taskPaneControl1, "TEST")
taskPanaValue.Width = 650
End Sub
...只要我在TaskPaneControl中有一个'空'构造函数,它就可以正常工作:
Public Class TaskPaneControl
Private WithEvents browser As ChromiumWebBrowser, chrome_popup As ChromiumWebBrowser
Private proc As New Process
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
'Dim settings As New CefSettings
End Sub
End Class
...但是当我在构造函数的底部取消注释“Dim settings As New CefSettings”时,我得到了上面提到的'System.IO.FileNotFoundException'错误。
Cefsharp通过Nuget Package Manager安装,所有引用都已正确设置。
我不知道为什么它不起作用?!
设置: