Could not load file or assembly 'CefSharp.dll' or one of its dependencies?

969 views
Skip to first unread message

kien Dang

unread,
Aug 13, 2013, 4:42:22 AM8/13/13
to cefs...@googlegroups.com
I've read and followed this site to handle the error


I've added CefSharp.dll and CefSharp.Winform.dll into project through "Add references"
I've also added libcef.dll and icudt.dll though "Add existing items" (Add as Link) and set "Copy if newer" for both of them
However, I'm still getting the following error:

An unhandled exception of type 'System.IO.FileLoadException' occurred in WindowsFormsApplication1.exe Additional information: Could not load file or assembly 'CefSharp.dll' or one of its dependencies. A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)

 this the code of the Form1

public partial class Form1 : Form
    {

        public WebView web_view;

        public Form1()
        {
            InitializeComponent();
            Settings settings = new Settings()
            {
                PackLoadingDisabled = true,
            };
            if (CEF.Initialize(settings)){
                web_view = new WebView("http://localhost:8084/wsmill", new CefSharp.BrowserSettings());
                web_view.Dock = DockStyle.Fill;
                toolStripContainer1.ContentPanel.Controls.Add(web_view);
            }
        }
    }

So anybody who know how to solve it please help me,
thanks
Kien 

Chris Westermann

unread,
Aug 19, 2013, 10:00:59 AM8/19/13
to cefs...@googlegroups.com
Getting the same thing.  First impressions not good of this project.  Will try and find out what the issue is using a dependency walker.

Chris Westermann

unread,
Aug 19, 2013, 10:12:23 AM8/19/13
to cefs...@googlegroups.com
Looking in dependency walker, it started off missing a few items found in Chrome like ffmpegsumo.dll, but then broke down wanting dozens of missing dependencies fore IE components.  I thought the whole point of chromium was to get away from IE and its dependencies?

per.lu...@ecraft.com

unread,
Aug 20, 2013, 1:47:25 AM8/20/13
to cefs...@googlegroups.com
Hi,

Sorry to hear about your bad experiences. Remember that CefSharp is a community project (which is also the reason why I haven't had time to answer so many emails lately in the group); we do our best to make CefSharp as good as possible, but there's obviously things that arent' working as excellent as they could (or should). The deployment hassle is one of these.

First step: download the latest release (1.25.3) and make sure you can run the .exe files in the Release folder. I just tried these on my local machine, it worked fine. If it doesn't, it probably means that you are missing the VC2012 redistributable (link on the FAQ page).

I'm not sure that the "Add existing items" approach will work. You must make *sure* that the bin\Debug (or bin\Release) of your WinForms app contains the required files; it seems like you have done this but I would guess that there's still something missing. What I've done personally is use a "post-build" command to basically xcopy the required CefSharp dependencies into the $(TargetFolder). It's not so hard actually, you could give it a try.

As mentioned, I think we all know that this is not so convenient and there is an issue (https://github.com/cefsharp/CefSharp/issues/137) that would make this quite a bit more convenient. Unfortunately neither me nor anyone else (as far as I know) has had time to work on it yet. Personally, I focus more on the WPF target for CefSharp since that's the one I use at work. For me, it works very well; it's just a matter of getting the right files in the right place in my experience.

Best regards,
Per
Reply all
Reply to author
Forward
0 new messages