Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClickOnceInstall CefSharp Winforms Problems

I'm trying to run my sample CefSharp WinForms project as a clickonceinstall application.

Everything is ok in the process of the creation, but when I try to install the program (the program is working of course and without issue), nothing happens! I tried this operation with many different configurations (releases, debug ecc ) and platform (x86, x64), but it's always the same issue.

What can I do?

I'm using Visual Studio 15 on Windows 10 64 bit.

like image 265
crasholino Avatar asked Dec 08 '22 00:12

crasholino


1 Answers

I also ran into this issue recently while deploying a ClickOnce application.

I found the solution for this problem on the CefSharp Issues page 1314 by the user @CRoemheld at this link here.

As noted elsewhere, ClickOnce will only bundle up managed .DLL's as part of its deployment process.

But we also need to include the native CEF DLL's as part of our app.

It doesn't look like there is an easy way to do this through the Visual Studio UI (I tried), but you can do it easily by manually modifying the .csproj file to include the following.

Open up your .csproj file and append the following snippet before the final </Project> identifier.

<ItemGroup>
<Content
Include="$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\x86\**\*;$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\locales\**\*.pak">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\**\en-GB.*;$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\**\en-US.*">
  <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
  <Visible>false</Visible>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x86.3.2526.1362\CEF\x86\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>

<ItemGroup>
<Content Include="$(SolutionDir)packages\CefSharp.Common.47.0.4\CefSharp\x86\**\CefSharp.BrowserSubprocess.*">
  <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
  <Visible>false</Visible>
</Content>
</ItemGroup>'

Once you do this, within Visual Studio, on the publish tab, when you click the "Application Files" button

enter image description here

You will see the required CEFSharp dependencies that will be deployed with the app.

enter image description here

like image 137
Ocean Airdrop Avatar answered Dec 28 '22 14:12

Ocean Airdrop