none
Host CefSharp.WinForm in Outlook 2010 addin RRS feed

  • Question

  • Hi there,

    I have been trying to host CefSharp.Winform (Chromium web browser control for winform) in OL2010 addin using VS2013 with no success.

    The steps:

    1. Create a outlook 2010 addin project.
    2. change solution setting from any CPU to x86 (CefSharp does not support any CPU).
    3. install CefSharp.Winfom using nugget.
    4. Access Cef, such as cef.initialize() in code.
    5. compile the project without error.

    But when run the addin, it gives error of "Cannot load file or assembly CefSharp.Core.dll or one of the dependencies.."

    The problem could be related to the way how addin resolve its dependencies.

    I tried to create a winform application with VS2013, and add support of CefSharp.Winform with same steps as described above. It all works without problem.

    Any trick to get CefSharp.WinForm to work in addin environment?

    Thanks.

    jhou

    Wednesday, June 17, 2015 12:42 PM

All replies

  • Hello Jhou,

    Do you have the x64 edition of Outlook 2010 installed on the PC?

    The fact is that x86 components (assemblies) can't be loaded into the x64 process. You need to get the x64 edition of the component.  

    I have found the following advice on the web:

    CefSharp is built using VC++ 2012 Update 4. Make note there a variants for x86 and x64, so depending on your application make sure they match.

    https://www.microsoft.com/en-us/download/details.aspx?id=30679

    When troubleshooting CefSharp some places to start are

    You may find a similar issue described on the following pages:

    "Could not load file or assembly 'CefSharp.Core.dll' or ..." when running CefSharp.Wpf.Example from another project

    Exception loading CEFSHARP.CORE.DLL

    Wednesday, June 17, 2015 12:56 PM
  • Thanks for the information.

    My Outlook is 32 bit edition in a windows 8.1 x64 environment. When I built x64 addin, it cannot be loaded at all.

    I have also reinstalled VC++ 2012 Update 4. However it did not make any difference.
    When I made a winform project with CefSharp, it works without problem, which might indicate the dependencies are there in my environment.

    Just wonder if something special in addin environment which prevent CEFSharp to load.

    Thanks again

    jhou

    Wednesday, June 17, 2015 1:16 PM
  • Jhou,

    Pay special attention to the fact that all other Windows Forms components work correctly in Outlook. So, I think the problem is in the CefSharp control, not Outlook or VSTO. I'd suggest contacting CefSharp developers instead.

    Wednesday, June 17, 2015 1:37 PM
  • This problem does not seem to be the CefSharp control issue. It is related to VSTO clickonce deployment.

    In the case of CefSharp package, it has several managed dlls along with several dependent unmanaged dlls, all of which have to be deployed in a same folder in order for it to work.

    However in Outlook addin project, I can only add references to those managed dlls in the project, but not dependent unmanaged dlls. The end result is that the unmanaged dlls are not deployed.

    There are tricks to make clickonce to deploy those unmanaged dlls, by adding those unmanaged dlls into project as content or link. There are quite a bit of forum discussions about this issue for winform/wpf clickonce deployment such as this one: Deploying WPF Application with 3rd Party DLLs.

    However the vsto addin adds extra twist to the clickonce deployment. VSTO runtime does not run the addin code from the installed location, but do a shadow copy of the installed dlls to a cache location as discussed in this article: Office customization creates/loads DLL from temporary folder.

    I could get all dependent unmanaged dlls copied to installed folder using the tricks for the winform/wpf application. However I could not find any way to ask vsto runtime to copy those unmanaged dlls along with the managed dlls during shadow copy.

    Is there a way disable shadow copy for vsto 4.0? (probably no).

    Is there a way to tell vsto to copy dependent unmanged dlls?

    Thanks

    jhou

    Saturday, June 27, 2015 2:19 PM
  • I believe the issue is not related to VSTO at all. Are you able to deploy a Windows Forms application with CefSharp.WinForm controls using ClickOnce? Do you get the same issue?

    If so, I'd suggest asking ClickOnce specific questions on the ClickOnce and Setup & Deployment Projects forum instead.

     
    Sunday, June 28, 2015 11:01 AM
  • There are quite extensive discussion about clickonce deployment of unmanaged dependent dlls in the scenario of winform/wpf foroms. With the tricks I mentioned in last reply, I have successfully deployed a winform application with support of CefSharp control using clickonce. The winform application runs the in the clickonce installed location, where all the unmanaged dependent dlls are deployed by clickonce. However vsto runtime does not run the addin from the installed location, but do extra shadow copy to temp directory (cache?) without dependent dlls. That is the difference between winform and vsto environment, which can be revealed using process monitor program.

    The problem is the shadow copy with vsto environment,

    Thanks

    jhou

    Sunday, June 28, 2015 2:26 PM
  • Just get back from ClickOnce and Setup & Deployment Projects forum. I was suggested to look for help in Outlook developer forum:

    https://social.msdn.microsoft.com/Forums/windows/en-US/49ccd9e6-c346-41fb-ab89-cde53e5cd71b/clickonce-deploy-unmanaged-dependent-dlls-in-vsto-environment?forum=winformssetup.

    A little bit more information about the issue is that once the CefSharp package is added to project, the addin cannot be loaded in development environment any more with the error of "CefSharp.Core.dll or its dependencies can be loaded...". The ProcMon shows dependent libceb.dll cannot be found.

    Thanks

    jhou

    Thursday, July 2, 2015 2:09 PM
  • @Jhou: Were you able to solve this problem? I am also facing a similar issue
    Friday, July 24, 2015 7:30 AM
  • No. I am giving up on this approach. Neither Outlook nor  ClickOnce and Setup & Deployment Projects group want to take this issue.

    The problem is that there is no information about how to control the shadow copying of all dependencies to the cache location in vsto runtime. 

    Friday, July 24, 2015 2:15 PM
  • @Jhou: Could you please tells about your new approach for this case? Do you find alternative to CefShar?
    Monday, July 27, 2015 9:06 AM
  • Just use WebBrowser control (winform or wpf), which relies on the installation of the latest IE on client machine.
    Monday, July 27, 2015 2:41 PM