Could not load file or assembly 'CefSharp.Core.dll
oh boy, it is a pain in the ass.
It all started when I decided to use CefSharp in my application. Problem was I was deploying my app though MS ClickOnce and deploying CefSharp and it's dependencies is a pain.
1st lesson
Do not add CefSharp and Xilium.CefGlue to the project. They both use different versions of 'CefSharp.Core.dll' and when you deploy they replace 'CefSharp.Core.dll' with different version rather than the one you used for developments.
2. When you install CefSharp, install cef.redist.x64 and cef.redist.x86 via Package Manager
3. We need to modify the project to
1. Deploy CefSharp and it's all dependancies
2. Deploy CefSharp runtime. Which is VC++ 2013 for 51.0.0.0
To do that:
Unload the main project. Right click -> Edit. Just before </project> past following code
<!-- Copy CEF Stuff-->
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\x86\**\*;$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\locales\**\*.pak">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Resource Include="Readme.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\**\en-GB.*;$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\**\en-US.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x86.3.2704.1432\CEF\x86\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\CefSharp.Common.51.0.0\CefSharp\x86\**\CefSharp.BrowserSubprocess.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<!-- Copy C++ 13 x84 redistributables -->
<ItemGroup>
<Content Include="$(ProjectDir)..\External\Microsoft.VC120.CRT\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
Note that this project is using cef.redist.x86.3.2704.1432, If you are using x64 you have to modify the above script.
You need to copy Microsoft.VC120.CRT from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT to a local folder and change "$(ProjectDir)..\External\Microsoft.VC120.CRT\**\*"
No comments:
Post a Comment