4

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
crasholino
  • 727
  • 1
  • 8
  • 13

4 Answers4

14

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

Pang
  • 9,564
  • 146
  • 81
  • 122
Ocean Airdrop
  • 2,793
  • 1
  • 26
  • 31
  • This is a good approach BUT, since Version 63 the unmanaged resources don't need to be added manually. See: https://github.com/cefsharp/CefSharp/wiki/Output-files-description-table-(Redistribution) for a list of all the files that are needed. – aydjay Jun 14 '18 at 07:58
1

I downloaded CefSharp and used the default WinForms example.

I had issues building in x64 so I skipped that and used x86.

This had a problem with the oneclick launcher. The logfile said it was crashing due to a manifest issue.

I found this which suggests a change to the settings .

"In project properties -> Application tab -> Resources -> checkbox Icon and manifest, the setting "Embed manifest with default settings" caused the problem. Setting it to "Create application without a manifest" fixes the problem."

I then deleted the manifest file under the WinForms.example tree. Performed a clean build and published!

Now I have a working oneclick.

Hopefully the manifest issue is the same as the one you are having.

Pang
  • 9,564
  • 146
  • 81
  • 122
Pomadomaphin
  • 116
  • 6
0

After a couple of days, finally I did it. The solution for the problem is the follow:

  1. Right click on the project ---> Unload Project
  2. Then Right click on the project again ---> Edit projectname.csproj
  3. At the and of the file, just before the closing tag add the following code: http://codepaste.net/ir2h7s (The block code seems doesn't work right now :\ )

  4. Right click on the project ---> Reload project

  5. Publish your app!
crasholino
  • 727
  • 1
  • 8
  • 13
0

I have practically the same answer as @Ocean Airdrop's, but also with the following additional things:

  1. Mind the CEF version. I have 69.0.0
  2. Mind the cef.redist version. It should be the same as the one you have on your project. Mine was 3.3497.1841;
  3. Include x64 as well, if you're having x64. Thus the more complete code snippet would be as follows:
<ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\x86\**\*;$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\locales\**\*.pak">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\**\en-GB.*;$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\**\en-US.*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x86.3.3497.1841\CEF\x86\**\*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\CefSharp.Common.69.0.0\CefSharp\x86\**\CefSharp.BrowserSubprocess.*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\x64\**\*;$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\locales\**\*.pak">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\**\en-GB.*;$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\**\en-US.*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\cef.redist.x64.3.3497.1841\CEF\x64\**\*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(SolutionDir)packages\CefSharp.Common.69.0.0\CefSharp\x64\**\CefSharp.BrowserSubprocess.*">
      <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
      <Visible>false</Visible>
    </Content>
  </ItemGroup>

Also, you need to still pay attention to the fact that you need to have Visual Studio C++ Redist on the target computer. Otherwise it's still not gonna work.

Pang
  • 9,564
  • 146
  • 81
  • 122
Monica Aspiras Labbao
  • 549
  • 2
  • 11
  • 30
  • I've set build target as AnyCPU and have edited .csproj file as mentioned above by @Monica-Aspiras-Labbao, changed CEF version and cef.redist version and have VIsual Studio C++ Redist as well but clickonce application does not start. Any thing else that needs to be edited? – AUser123 Apr 16 '19 at 05:12