0

I created two projects: the first is a typical HTTP triggered Azure function and the second is just a sample of CefSharp.MinimalExample.OffScreen app. Azure function references CefSharp proj for screenshot-making purposes. This referencing works perfect locally, but not in Azure. After publishing Log streaming utility shows problem with loading assembly 'CefSharp.Core.DLL'

2019-04-26T19:09:57.132 [Info,Function1] Function started (Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info,Function1] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info,Function1] C# HTTP trigger function processed a request.
2019-04-26T19:09:57.148 [Error] A ScriptHost error has occurred
2019-04-26T19:09:57.148 [Error] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.194 [Error,Function1] Exception while executing function: Function1
2019-04-26T19:09:57.194 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.194 [Error,Function1] Function completed (Failure, Id=1824ad19-be9e-4fd1-a3a4-17e770967164, Duration=73ms)
2019-04-26T19:09:57.210 [Error,Function1] Executed 'Function1' (Failed, Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.210 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.210 [Error,Function1] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '1824ad19-be9e-4fd1-a3a4-17e770967164'
2019-04-26T19:09:57.210 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.210 [Error] {"id":"42f419f5-9cc7-4c90-bd6b-92836626c25f","requestId":"213b53eb-ee2c-475e-8094-a9e2ebcb6665","statusCode":500,"errorCode":0,"message":"An error has occurred. For more information, please check the logs for error ID 42f419f5-9cc7-4c90-bd6b-92836626c25f"}
2019-04-26T19:09:57.210 [Error] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.132 [Info] Function started (Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info] C# HTTP trigger function processed a request.
2019-04-26T19:09:57.194 [Error] Function completed (Failure, Id=1824ad19-be9e-4fd1-a3a4-17e770967164, Duration=73ms)

My project structure and FTP dll's enter image description here

  • I used Release | x64 (net461) configuration for publishing because build failed for x86 (System.BadImageFormatException) bla, bla..
  • I slightly modified nuget CefSharp.OffScreen.targets file and added bin folder as CefSharpTargetDir because half of assemblies were out of bin folder
  • I checked kudu and ftp that D:\home\site\wwwroot\bin> contains all the files needed cefsharp to start.

Its interesting that if Azure Webjob (AuthWebjob.csproj) references Cefsharp everything works ok!. Probably i miss something either in project structure or in app settings of Azure VM.

Trinitron
  • 374
  • 3
  • 12
  • which version of azure function are you using ? v1 works for .net framework. v2 works for .net core – Thomas Apr 28 '19 at 04:43
  • @Thomas AzureFunctionsVersion v1, TargetFramework net461, i think it is default Functure proj template for VS2017 – Trinitron Apr 28 '19 at 09:25
  • Can you check on the azure portal that the app setting `FUNCTIONS_EXTENSION_VERSION` = `~1` ? – Thomas Apr 28 '19 at 23:56
  • @Thomas Yes, exactly what you says FUNCTIONS_EXTENSION_VERSION = ~1, platform x64. If needed i can send you my solution to test. – Trinitron May 02 '19 at 15:07

1 Answers1

-1

With CefSharp.Core being a native C++ library, you can try switching your function to V2 and copying the binaries to wwwroot\ folder via FTP. If that doesn't work, then I'm afraid it may not be supported yet. I came across github issues here, here, and here that point to its a feature that's been requested but not yet adopted.

Ryan Hill
  • 1,821
  • 2
  • 8
  • 21