Skip to content
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

.NET 6 BrowserSubProcess asks to install .Net Core 3.1 #4295

Closed
mortan opened this issue Nov 8, 2022 · 5 comments
Closed

.NET 6 BrowserSubProcess asks to install .Net Core 3.1 #4295

mortan opened this issue Nov 8, 2022 · 5 comments

Comments

@mortan
Copy link

mortan commented Nov 8, 2022

Hi,

we include CefSharp.WPF.NETCore in our .NET 6 application. As it turns out (from a troubleshooting session with a customer) you also need to install the .NET Desktop Runtime 3.1(.30) to be able to use CefSharp in our .NET 6 application. Otherwise the main application starts just fine (.NET 6 Desktop Framework is installed) but as soon as you want to access the browser control you get a message about a missing .NET (3.1) framework.

Could you please add a Nuget package for .NET 6 so we don't have to install another runtime on our clients computers?

Thanks and kind regards

@amaitland amaitland changed the title Feature Request - .NET 6 target for CefSharp.Wpf.NETCore Feature Request - .NET 6 BrowserSubProcess Nov 8, 2022
@amaitland
Copy link
Member

Otherwise the main application starts just fine (.NET 6 Desktop Framework is installed) but as soon as you want to access the browser control you get a message about a missing .NET (3.1) framework.

The main libs are compiled as .Net Core 3.1, they're referenced as part of your project and as such will be running in .Net 6.0. It's CefSharp.BrowserSubprocess.exe that's shipped by default as .Net Core 3.1 for x64/x86 and .Net 5.0 for arm64 and is what I expect to be the source of the dialog you are seeing.

Unfortunately Nuget doesn't provide any means that I'm aware of for providing different builds of the exe. I'm not planning on upping the minimum version at this time.

CefSharp.BrowserSubprocess.exe is set to RollForward to use a newer version. It's possible for some reason this isn't working as expected. Please provide details of your build configuration, SelfContained, SingleFile etc. The steps troublshooting steps at #3436 (reply in thread) can be used to gather all the relevant information.

you also need to install the .NET Desktop Runtime 3.1(.30) to be able to use CefSharp in our .NET 6 application

CefSharp.BrowserSubprocess.exe is provided as the default sub process implementation, you can self host (use your own exe instead).

Publishing self contained app is not necessary to self host.

I'm going to remove the feature requests tags for now.

@amaitland amaitland changed the title Feature Request - .NET 6 BrowserSubProcess .NET 6 BrowserSubProcess asks to install .Net Core 3.1 Nov 14, 2022
@mortan
Copy link
Author

mortan commented Nov 15, 2022

Hi @amaitland and thanks for the response!

Here is the output of the CefSharpAfterBuildDebug target:

CefSharp After Build Diagnostic
  CefSharpBuildAction = Default
  RuntimeIdentifier = win-x64
  CefSharpRuntimeIdentifier = win-x64
  Platform = AnyCPU
  PlatformName = AnyCPU
  Platforms = AnyCPU
  PlatformTarget = x64
  PlatformTargetAsMSBuildArchitecture =
  TargetFramework = net6.0-windows10.0.18362.0
  TargetFrameworkVersion = v6.0
  NuGetProjectStyle = PackageReference
  SelfContained = true
  PublishSingleFile = false
  OutDir = bin\Debug\
  _CefSharpBrowserSubProcessFiles = C:\Users\XXX\.nuget\packages\cefsharp.common.netcore\102.0.100\runtimes\win-x64\na
  tive\CefSharp.BrowserSubprocess.runtimeconfig.json
  IncludeAllContentForSelfExtract =
  IncludeNativeLibrariesForSelfExtract =

Any idea why the roll RollForward is not working? I would appreciate that option to work and not add more complicated logic in form of a CefSharp.BrowserSubprocess.exe self host to our deploys.

Kind regards

@amaitland
Copy link
Member

You appear to be generating a SelfContained = true build, try SelfContained = false and installing the runtime on the target machine.

I would appreciate that option to work and not add more complicated logic in form of a CefSharp.BrowserSubprocess.exe self host to our deploys.

Self hosting isn't complicated. It in general provides the best user experience. This is the option I would recommend.

There's a WPF example at https://github.com/cefsharp/CefSharp.MinimalExample/blob/master/CefSharp.MinimalExample.Wpf/Program.PublishSingleFile.cs

@mortan
Copy link
Author

mortan commented Jul 12, 2023

@amaitland the roll forward works as long as there are .NET runtimes installed in C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App

Having a self-contained, published .NET 6 application is not sufficient. Deleting the CefSharp.BrowserSubprocess.runtimeconfig.json file as you describe here solves the roll forward problem!

#3407 (comment)

Closing the issue as deleting the file solves my problem.

@mortan mortan closed this as completed Jul 12, 2023
@amaitland
Copy link
Member

There are exclusions in place to remove CefSharp.BrowserSubprocess.runtimeconfig.json from the build output for SelfContained builds.

https://github.com/cefsharp/CefSharp/blob/master/NuGet/PackageReference/CefSharp.Common.NETCore.targets#L45

You can generate a structured build log and see what's going on if you want to debug this further.

https://learn.microsoft.com/en-us/shows/visual-studio-toolbox/msbuild-structured-log-viewer

Pull requests with improvements welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants