-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClickOnce application not starting #1314
Comments
I own an application that is Click Once using CefSharp(version 39.0.2), you need the libcef.dll and icudtl.dat, along with cef.pak and the locales folder(only the locales you allow, otherwise you can disable PAK file loading in settings when you initialize). You also will need both the sub-process files, they are both critical. We have a custom script to make our Click Once work, I had to make the native images deploy as data files otherwise the tools tried to load them as .NET assemblies and complained that they were invalid images. Not sure how you are generating the Click Once deployment though, you may not have the same issues. |
@taylorjonl I'm right-clicking on my projects name in the solution folder on the top right -> publish... So basically I'm using the standard way to publish and build my project. No errors coming up, no entries in any debug.log file. Just an application which is not starting after "installing" it. |
It isn't starting because it doesn't have the required files to load CefSharp.Core. You need to figure out how to get Click Once to deploy those files. In our application(using 39.0.2) we deploy the following: locales/*.pak(too many to list) In your listings of the *.deploy files I don't see any of them. You need to figure out how to get Click Once to deploy them or the application will never start. |
@taylorjonl Okay, everything fine so far. As I mentioned, on the StackOverflow site an user tried to solve the deployment of the missing file with an xcopy command setting in the projects build events at "post-build event command line"
Problem: This line just copies everything as it is from one folder to the target. This means the files you listed in your comment before are in some subfolders and _not_ in the projects root (the folder the .exe file lies in). How did you manage to get those files deployed? Did you place them somewhere special before building and set up some build events? |
We are talking different things, you are talking about getting them to the build output folder I am talking about getting Click Once to include them in the deployment. We use MSBUILD tasks and targets to make our deployment since it is quite complex and the default publish mechanism didn't work well for us. First we have this target that determines which files will be packaged: <Target Name="DeterminePackageFiles">
<ItemGroup>
<ConfigFiles Include="$(OutDir)\*.exe.config"/>
<DataFiles Include="$(OutDir)\icudtl.dat;$(OutDir)\ProfileCatalog.xml;$(OutDir)\**\*.pak;"/>
<NativeDLLs Include="$(OutDir)\d3dcompiler_43.dll;$(OutDir)\d3dcompiler_47.dll;$(OutDir)\ffmpegsumo.dll;$(OutDir)\libEGL.dll;$(OutDir)\libGLESv2.dll;$(OutDir)\libcef.dll;$(OutDir)\pdf.dll"/>
<ManagedDLLs Include="$(OutDir)\*.dll" Exclude="@(NativeDLLs)"/>
<Tools Include="$(OutDir)\CefSharp.BrowserSubprocess.exe"/>
</ItemGroup>
</Target> Then in another target we parts that will prepare the click once directory: <Target Name="PrepareClickOnceDir" DependsOnTargets="GetPackageVersion;DeterminePackageFiles">
<MakeDir Directories="$(ClickOnceDir);$(ClickOnceDir)\$(PackageVersion)"/>
<ItemGroup>
<EntryPoint Include="$(OutDir)\$(ApplicationName).exe" />
<IconFile Include="$(OutDir)\App.ico"/>
<Dependency Include="@(ManagedDLLs)" Exclude="@(EntryPoint)">
<AssemblyType>Managed</AssemblyType>
<DependencyType>Install</DependencyType>
</Dependency>
<File Include="@(ConfigFiles);@(DataFiles);@(NativeDLLs);@(Tools)">
<TargetPath>%(RecursiveDir)%(Filename)%(Extension)</TargetPath>
</File>
</ItemGroup>
<Message Text="Creating Application Manifest: $(ApplicationName).exe.manifest" />
<GenerateApplicationManifest AssemblyName="$(ApplicationName).exe"
AssemblyVersion="$(PackageVersion)"
Dependencies="@(Dependency)"
Files="@(File)"
EntryPoint="@(EntryPoint)"
IconFile="@(IconFile)"
ClrVersion="4.0.30319.1"
TargetFrameworkVersion="v4.0"
TargetFrameworkMoniker=".NETFramework,Version=v4.0"
OutputManifest="$(ClickOnceDir)\$(PackageVersion)\$(ApplicationName).exe.manifest">
<Output ItemName="ApplicationManifest" TaskParameter="OutputManifest"/>
</GenerateApplicationManifest>
<Message Text="Signing Application Manifest:@(ApplicationManifest)" />
<Exec Command="$(MagePath) -Sign "@(ApplicationManifest)" -cf $(CertificatePath)"/>
<CreateItem Include="@(ApplicationManifest)" AdditionalMetadata="TargetPath=$(PackageVersion)\$(ApplicationName).exe.manifest">
<Output TaskParameter="Include" ItemName="ApplicationManifestWithPath"/>
</CreateItem>
<ItemGroup>
<DeployFiles Include="$(OutDir)\App.ico;$(OutDir)\$(ApplicationName).exe;@(ConfigFiles);@(DataFiles);@(NativeDLLs);@(ManagedDLLs);@(Tools)"/>
</ItemGroup>
<Copy SourceFiles="@(DeployFiles)" DestinationFiles="@(DeployFiles->'$(ClickOnceDir)\$(PackageVersion)\%(RecursiveDir)%(Filename)%(Extension).deploy')"/>
<Message Text="Creating Deployment Manifest: $(ApplicationName).application" />
<GenerateDeploymentManifest AssemblyName="$(ApplicationTitle).application"
AssemblyVersion="$(PackageVersion)"
DeploymentUrl="$(ApplicationUrl)"
Description="$(ApplicationDescription)"
EntryPoint="@(ApplicationManifestWithPath)"
Install="true"
TargetFrameworkMoniker=".NETFramework,Version=v4.0"
OutputManifest="$(ClickOnceDir)\$(ApplicationName).application"
MapFileExtensions="true"
Product="$(ApplicationTitle)"
Publisher="$(Company)"
SupportUrl="$(SupportUrl)"
UpdateEnabled="true"
UpdateMode="Foreground"
TrustUrlParameters="true">
<Output ItemName="DeployManifest" TaskParameter="OutputManifest"/>
</GenerateDeploymentManifest>
<Message Text="Setting Package Version: $(PackageVersion)" />
<Exec Command="$(MagePath) -u "@(DeployManifest)" -v $(PackageVersion) -mv $(PackageVersion)" />
<Message Text="Signing Deployment Manifest:@(DeployManifest)" />
<Exec Command="$(MagePath) -Sign "@(DeployManifest)" -cf $(CertificatePath)"/>
<ItemGroup>
<ClickOnceWebFiles Include="ClickOnce\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="@(ClickOnceWebFiles)" DestinationFolder="$(ClickOnceDir)"/>
<MSBuild.ExtensionPack.FileSystem.File TaskAction="Replace" RegexPattern="#VERSION#" Replacement="$(PackageVersion)" Files="$(ClickOnceDir)\publish.htm"/>
</Target> I don't have any understand on how to get it working with the default publish mechanism in Visual Studio though. |
@taylorjonl Sorry, yes I was talking about the deployment, not the build (the build works perfect as mentioned in the opening post). UPDATE After 2 days i finally managed to get the missing files into deployment. I added the following code at the end of the project.csproj file, just before the closing tag. Thanks for your help @taylorjonl ! <ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\x64\**\*;$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\locales\**\*.pak">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Resource Include="icon.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\**\en-US.*;$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\**\de.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x64.3.2357.1287\CEF\x64\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\CefSharp.Common.43.0.0\CefSharp\x64\**\CefSharp.BrowserSubprocess.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup> |
@croemheld Thank you for this! I've been looking for what seems ages for this! |
+1 for @croemheld's clean and simple solution of modifying the .csproj file. Can confirm this works with my test ClickOnce deployment. I am targeting build CEF 47.0.4 and x86. Here is my snipped project.csproj
Thank you @croemheld. |
Hi all, We're experiencing what sound like identical problems to those that you guys have already overcome, however we can't seem to get this thing working in our project! I wonder if any of you could let us know what we're doing wrong! In short, our application works fine in debug but not once published (click-once). We've gone through numerous suggested fixes across multiple threads and not got anywhere. The upshot is we're still not getting the required files (dll's etc) to copy across when publishing and we think the approach above is what we need to nail down. We're currently targeting .NET 4.5.2, and have installed CefSharp.Wpf (version 57.0.0.0, run-time: v4.0.30319) via the package manager console. Also added what I believe are all of the pre-requisites in the project properties. I've then gone onto add the following to my csproj client file, based on the versions we're using:
And we've also got another entry in this csproj:
Can anyone see anything glaringly obviously incorrect about the information I've given above? Any simple steps I've neglected to undertake? Any help would be greatly appreciated! Regards Tom |
Hi Tom, Been a while since this cropped up. From memory all I needed to do was modify the .csproj with that snip above and all worked!! After my fix, I also answered this question on stack overflow. One other test to perform after you have made the modifications to the .csproj is to look at the "application files" in the publish tab. I have pictures on my stack overflow answer. This will show you all the files that will be bundled up with the ClickOnce deployment. If the cef files are not there perhaps you need to double check your paths in the .csproj file. Once you see them in that window you are good to go! Here is the SO post: https://stackoverflow.com/questions/34225222/clickonceinstall-cefsharp-winforms-problems/39675335#39675335 |
One other thing I have just remembered.... This might not be your issue but I thought I would mention it. We had issues around the "Any CPU" setting of the solution. As you know all Dot-net solutions default to "Any CPU". My memory is a bit hazy on the reasons why, but we had to force our .net app to be x86 (change it from AnyCPU to x86). Here's the thing. If you have previously deployed the ClickOnce as "Any CPU" you cant change the app half way though. This is a change to the signature of the app (stupid, I know). We had to deploy our app to a different location. Now, I don't know what your situation is but if you can see the files that should be deployed via the "application files" button, try changing the project to an x86 project and deploy to a 2nd URL to test it works. In the snip of your .csproj file above it looks like you are targeting the x86 version of the CEF binaries. Try changing your project to x86 and see what happens! |
Hi OceanAirdrop, Just wanted to drop you a 'thank you' for the advice/resources; it wasn't actually any of the above but your post did give me the step-by-step reference to follow and subsequently identify where there were differences. For anyone interested, we were referencing the Runtime Version of the CefSharp.Wpf.dll (4.0.30319) as opposed to the actual folder package name within the solution (3.2987.1601) - this was due to my lack of understanding of how the new entries within the csproj file worked and by delving into this a little this identified our problem. Doh! Again, thanks for your help! Tom |
Hi Tom. Cheers. Good to here you are up and running over there. |
@tomwestwood I would love to hear a bit more on the fix.. I have been fighting this for a couple of days now. |
Hi Brandon, If you're having the same problem we were, I'd advise ensuring the ItemGroup entries you've added into the .csproj file match up with those in the packages folder of your solution (browse to the root of your solution with windows explorer). Also ensure you are targeting x86. We didn't require and pre/post build commands or anything like that in the end. What steps have you taken so far? I can tell you the exact order we did things in if that would help? Tom |
Yeah anything helps.. I added the csproj additions to the bottom. The build server is building targeting x86 and the mage.exe is being called with x86 as well. I am not totally sure what is missing. Brandon |
@tomwestwood are you willing to share the final csproj inclusion and any other gotchas you hit? I know it has to be something small. Thanks Brandon |
Find attached the full .csproj file (shown when you right-click > unload your Client project and then edit the .csproj file in Visual Studio). The info that I changed manually is right at the bottom. |
i am having same issue, i have a clickonce setup that i execute through Task Scheduler. a very quick window appears and then suddenly disappears in no time. i am facing this issue only on windows 10, on windows 7, 8 its working perfect. anyone has any idea? |
This comment has been minimized.
This comment has been minimized.
Excellent work Alex. Thanks. |
@croemheld Thank you. Worked like a charm! |
Reports suggest it appears it is still required. If your clickonce installer isn't including the You should in theory be able to create your own <ItemGroup>
<Content Include="@(CefRedist32)">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries32)">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup> This approach should not require any changes if you update to a newer version. NOTE: I have not tested this, pieces might be missing or incorrect, it's up to someone producing a |
Based on croemheld's answer, I've created this approach which works with PackageReferences.. <!-- Include CefSharp files for support of ClickOnce deployment -->
<ItemGroup>
<Content Include="$(UserProfile)\.nuget\packages\cef.redist.x86\3.3578.1870\CEF\**\*" Exclude="$(UserProfile)\.nuget\packages\cef.redist.x86\3.3578.1870\CEF\locales\*.pak">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(UserProfile)\.nuget\packages\cef.redist.x86\3.3578.1870\CEF\**\en-US.*;$(UserProfile)\.nuget\packages\cef.redist.x86\3.3578.1870\CEF\**\de.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(UserProfile)\.nuget\packages\cef.redist.x86\3.3578.1870\CEF\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(UserProfile)\.nuget\packages\cefsharp.common\71.0.2\CefSharp\x86\*.dll">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(UserProfile)\.nuget\packages\cefsharp.common\71.0.2\CefSharp\x86\*.exe">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Content Include="$(UserProfile)\.nuget\packages\cefsharp.wpf\71.0.2\CefSharp\x86\*.dll">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup> |
@amaitland I tweaked your suggestion as follows, and it seems to run via ClickOnce just fine, but there are a lot of compiler warnings.
Theoretically Warnings are along the lines of:
|
I've targeted AnyCPU in my windows forms application with CEF 3.3578.1870. The applications works fine but clickonce application is not started. I've tried editing the .csproj file as mentioned by @croemheld and included both for x64 and x86. But upon editing the .csproj, the error of FileNotFound exception arises and application no longer runs. Also, tried adding the dlls as resource/content to copy in build folder. But clickonce application is not launched.. Is there anything else that I missed? Any help would be appreciated. |
Further building on @amaitland 's comment above. I have:
This so far seems to work ok and definitely makes it more convenient than having to unload the .csproj file every time when testing. VS does warn me about:
Is there any way to exclude these files whilst preserving a CefSharp version ignorant targets file? |
Hello all, I am having the same issue. I followed the steps mentioned by @croemheld and a few other settings, but nothing seems to work. I set the target platform to AnyCPU and I am able to install and run the application. However, the issue is, when I enter the Url and click on the Go button on my application, the browser is not loaded with the specified link. It works fine on the visual studio when I build and run my application. (The application is a simple browser like application. a text box where the user enters the Url clicks a button which handles the click event to load the CefSharp browser navigating to the Url specified by the user). Can someone please help me figure out what am I doing wrong? Thanks in advance. |
@croemheld |
I've had the .targets file solution working with ClickOnce AnyCPU for nearly a year now w/ v79.x. I tried updating to the latest (as of today v83.4.2[0]), and ClickOnce stopped working. :/ I use a combination of the hacks above plus the hacks in #1714 (Option #2). I have enabled extensive logging to file during ClickOnce startup and can see it is failing to load the x64 assemblies. Still investigating... |
Ah! PEBCAK! |
Thanks @amaitland! That actually did help a little! |
FYI, my working .targets file is: <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Condition="'$(Platform)' == 'x64' Or '$(Platform)' == 'AnyCPU'">
<Content Include="@(CefRedist64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpWinFormsBinaries64)">
<Link>x64\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x86' Or '$(Platform)' == 'AnyCPU'">
<Content Include="@(CefRedist32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpCommonBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
<Content Include="@(CefSharpWinFormsBinaries32)">
<Link>x86\%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PublishState>Include</PublishState>
<Visible>false</Visible>
</Content>
</ItemGroup>
</Project>
All I do is include this at the end of my .csproj file: <Import Project="MyProject.targets" /> |
Here's yet another solution. I added this to my project's csproj file. Note this depends on the newer PackageReference way of specifying NuGet package dependencies, also it suffers from the problem of having to update all the version strings when upgrading to a new version of CefSharp (this could be avoided by using Pkg refs available in VS 2019, I'm using VS 2017 though):
If anyone knows how to fix those msbuild warning messages, I'd be excited to hear about it. |
The In an attempt to better support |
Anyone having problems my suggestion would be to upgrade to |
Thanks @amaitland for the new update, sounds interesting. But will not be able to do the update now as it is still in preview, and we are just pending deployment on the new solution. |
This is only working for UPDATE: I've only tested with |
This Worked |
This comment has been minimized.
This comment has been minimized.
Anyone targeting x86/x64 should use the instructions linked at #1314 (comment) Both VS2017 and VS2019 should work as expected. For targeting AnyCPU self hosting the browser sub process should resolve the problem described in #3319 (comment) (also following the instructions listed at #3319 (comment)). Self hosting details at #3407 (comment) (If targeting .Net 4.x the code used should be exactly the same). As there is a lot of outdated information contained within this thread I'm going to lock the conversation. If you are still having problems then please join in the discussion at #3613 |
I know, I know, there have been several issues and most of them were working for others but me.
I've seen [https://github.com//issues/500] and [https://github.com//issues/625].
Project: WPF application in Visual Studio 2013
CefSharp 3.2357.1287
Both x86 and x64 CPUs .
CefSharp.Wpf version: 43.0.0
When opening the folder with the published files, it looks like this:
According to the other posted issues, especially by stepanets in issue 625 (at the very end), there would be missing a locales folder as well as libcef.dll and icudtl.dat. I don't know if the files CefSharp.BrowserSubprocess.Core.dll and CefSharp.BrowserSubprocess.exe are necessary for this build.
I tried to run the dependency checker on my projects .exe file, but nothing shows up on it's console (I'm using the dependency walker from http://www.dependencywalker.com).
And I have to admit, the "Getting started" section of CefSharp might be a little unclear on copying the files to some special places. (Maybe it's because English is not my native laguage... maybe I'm just too new in this place).
Running the .exe file in the debug and release folder in both CPUs (x86 and x64) is working fine. Even the locales folder and the missing .dll files are in the same folder as the projects .exe. But when publishing via ClickOnce, the files seem to get lost.
UPDATE:
I've also tried to follow the instructions mentioned on StackOverflow: The problem was, the missing files were copied to subfolders, not the folder the .exe file is located in. Result is the same: application does not start, neither do I find any folders the project has been installing in.
Thanks a lot! Really appreciate your work and help!
The text was updated successfully, but these errors were encountered: