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

NETCore - Move Runtime Files to custom Subfolder doesn't work #4813

Closed
1 task done
Xan-Kun opened this issue May 29, 2024 · 4 comments
Closed
1 task done

NETCore - Move Runtime Files to custom Subfolder doesn't work #4813

Xan-Kun opened this issue May 29, 2024 · 4 comments
Labels

Comments

@Xan-Kun
Copy link

Xan-Kun commented May 29, 2024

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

124.3.80

Operating System

Windows 10

Architecture

x64

.Net Version

.NET 8

Implementation

WinForms

Reproduction Steps

Create a brand new minimal x64 WinForms project.
Include CefSharp.WinForms.NETCore.
Try any approach from the docs or SO and the the cefsharp files will not be put into a subdirectoy.

Just to be clear: I am not talking about AnyCPU support, since this is another can of worms :-)
Even with AynCPU it doesnt really work: the files are initally created in the runtimes subfolder, but after publis as self-contained, the files are back in the root of the application.

I think I tried all (reasonable) combination of these settings and the only thing that ever happens is the runtimes part during compilation.

	<PropertyGroup>
		<OutputType>WinExe</OutputType>
		<TargetFramework>net8.0-windows7.0</TargetFramework>
		<!--<RuntimeIdentifier>win-x64</RuntimeIdentifier>-->
		<Nullable>enable</Nullable>
		<!--<PlatformTarget>x64</PlatformTarget>-->
		<PlatformTarget>AnyCPU</PlatformTarget>
		<UseWindowsForms>true</UseWindowsForms>
		<ImplicitUsings>enable</ImplicitUsings>
		<SelfContained>true</SelfContained>
		<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
		<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
	</PropertyGroup>

	<PropertyGroup>
		<CefSharpExcludeSubProcessExe>true</CefSharpExcludeSubProcessExe>
		<CefSharpBuildAction>None</CefSharpBuildAction>
		<!--<CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
		<CefSharpPlatformTargetOverride>AnyCPU</CefSharpPlatformTargetOverride>-->
		<CefSharpTargetDir>CefSharp</CefSharpTargetDir>
	</PropertyGroup>

The goal is to have just the win-x64 lib & native files in a dedicated sub-directory like cef_sharp_files.
Even after publish to folder.

The loading is not a problem, btw.

Ideally, we would have a MinimalExample for this case

Expected behavior

Formerly we had CefSharpTargetDir, but that doesnt seem to do anything anymore. Having a functionality like that again would be ideal.

Actual behavior

None of the tried ways put the lib & native files in a dedicated directory after publish.

Regression?

See CefSharpTargetDir in previous versions.

Known Workarounds

none

Does this problem also occur in the CEF Sample Application

No

Other information

No response

@Xan-Kun
Copy link
Author

Xan-Kun commented May 29, 2024

P.S.: I am aware there is another discussion on a similar topic, but it is about AnyCPU there and has nothing to do with publishing, as I understand it. Anyways, I tried everything here too and nothing solves it.

@Xan-Kun
Copy link
Author

Xan-Kun commented May 29, 2024

Just to be totally sure, I just tried again with the CefSharp.MinimalExample, the only change that was made was

<TargetFrameworks>net8.0-windows</TargetFrameworks>

And after publish as self-contained, the files are all in the root again.

@amaitland amaitland changed the title Move Runtime Files to custom Subfolder doesn't work NETCore - Move Runtime Files to custom Subfolder doesn't work May 29, 2024
@amaitland
Copy link
Member

Formerly we had CefSharpTargetDir, but that doesnt seem to do anything anymore. Having a functionality like that again would be ideal.

CefSharpTargetDir is not supported by the NETCore packages. The packages use Architecture-specific folders to comply with the nuspec standard.

For the assets to be correctly added to the .deps.json file we need to rely on the built in behaviour. Support for copying to a sub folder is not something we can add specifically to the packages, you'll need to rely on solutions provided by Microsoft (Or one of the third party hacks).

And after publish as self-contained, the files are all in the root again.

This is the expected behaviour.

NuGet/Home#5986 (comment) has some suggestions on workarounds. There's another issue also that discusses the options, I just don't remember the URL at the moment.

I think I tried all (reasonable) combination of these settings and the only thing that ever happens is the runtimes part during compilation.

Rather than guessing, I'd suggest reviewing the https://github.com/cefsharp/CefSharp/blob/master/NuGet/PackageReference/CefSharp.Common.NETCore.targets file to see what customisations are actually supported.

Closing as this is not something we can add direct support for.

@amaitland amaitland closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@Xan-Kun
Copy link
Author

Xan-Kun commented May 30, 2024

I know the referenced Nuget issue, and already feared it would come down to this (managing every single file myself, which completely defeats the purpose of a "package manager" :-)
Atm I am having so many problems with CefSharp (esp the HW-acceleration part interferes massively with multiple other packages) that I am tyring to switch to WebView2, which I really dont like, but it seems CefSharp simply doesnt work anymore in this use case.
Another way would be to switch back to CefSharp.WinForms (without the netcore) since it worked perfectly back then.
Anyways, thanks again for the library 👍

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

No branches or pull requests

2 participants