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

Refactor CefSharp.Core into CefSharp.Core.Runtime #3311

Merged
merged 38 commits into from
Dec 16, 2020

Conversation

amaitland
Copy link
Member

@amaitland amaitland commented Dec 9, 2020

Summary:

Restructure projects/packages to

  • Better support .Net Core/5.0
  • CefSharp.Core.dll is now written in C# with CefSharp.Core.Runtime.dll being the runtime dependency that provides the Mixed Mode CLI/C++ implementation.
  • Simplify AnyCPU targeting
  • Resolves issue with pacakges.config based projects having to reload the solution for the dependencies to show up
  • Remove requirement for package consumers having to change $(Platform) at the solution level ($PlatformTarget) at project level is now sufficient
  • Greater control over how libcef.dll is loaded.
  • Potential to add additional runtime checks like validating VC++ is installed.
  • Upgrade GitLink

Changes:

  • Convert from x86/x64 to AnyCPU.

    • CefSharp.dll
    • CefSharp.WinForms.dll
    • CefSharp.Wpf.dll
    • CefSharp.OffScreen.dll
    • Included in lib\net452 folder in Nuget packages, can no longer be moved by setting CefSharpTargetDir property in project file (msbuild).
  • Rename CefSharp.Core.dll to CefSharp.Core.Runtime.dll

    • No longer directly referenced by client applications
    • All the Public API methods it exposes are hidden from Visual Studio Intellisense
    • Used indirectly through new CefSharp.Core.dll (AnyCPU class library).
  • Add CefSharp.Core.dll

    • Managed (AnyCPU) dll that provides the public API
    • In .Net Core there will be a CLR Module Initializer to load libcef.dll from the relevant location where required
    • Additional runtime checks can be added to validate if say VC++ is installed
    • Generally give more control over loading of the unmanaged resources and setting the relevant paths e.g. BrowserSubProcessPath
    • NOTE: In Theory we could use a CLR Module Initializer in .Net 4.5.2 and load the dlls at runtime to support AnyCPU,
      this would require some breaking changes to the public API, so have added support for a app.config transform based on Move platform dependent files to respective directories. #3168

How Has This Been Tested?
Unit tests pass sucessfully. The MinimaExample works in the cases tested so far.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Updated documentation

Checklist:

  • Tested the code(if applicable)
  • Commented my code
  • Changed the documentation(if applicable)
  • New files have a license disclaimer
  • The formatting is consistent with the project (project supports .editorconfig)

Partial rename, only Net Core, folder not renamed
Move into CefSharp.Core namespace
Make sure users don't attempt to load them directly
… variant

Attempt to load CefSharp.Core.Runtime at runtime rather than having to use msbuild to copy the correct version
As they are all managed assemblies they can target AnyCPU.
Includes CefSharp.dll
Now part of the CefSharp.Core PublicApi
If no RID is specified then we can load libcef.dll using the module initializer
Improve AnyCPU support
@amaitland amaitland added this to the 87.0.x milestone Dec 9, 2020
@amaitland amaitland self-assigned this Dec 9, 2020
@amaitland
Copy link
Member Author

amaitland commented Dec 9, 2020

TODO:

  • Determine if we can use Arch Specific folders to get around having to implement the hack added in commit 5d4cd24
    It's likely to be a little bit hacky using the .Net 452 dlls in a netcoreapp3 folder

  • Fix typos in new Cef class ( Fix typos #3306)

  • Investigate better solution to commit ee05ef2
    Had to duplicate the files in lib\netcoreapp3 folder as the lib\net452 dlls weren't being referenced in solution for netcoreapp3.x.
    Was unable to find a better solution, tried copying the files into just the runtimes\win-{arch}\lib folder without success. Tested with PacakgeReference targeting .Net 4.5.2 and it appears to pickup the lib\net452 dlls successfully

  • Automatically generate net452 ref assembly source code as part of build script.

    • Investigate if this can be done via MSBuild

For now the powershell build script generates the .cs file based on a x86 release build.ps1
It's not possible to directly install GenApi as it requires a Sdk style project
@AppVeyorBot
Copy link

@amaitland amaitland marked this pull request as ready for review December 12, 2020 04:35
@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@amaitland amaitland mentioned this pull request Dec 12, 2020
20 tasks
- Move ref assembly source generate into GenerateRefAssemblySource.ps1
- Call before project build

Runs locally, see if Appveyor has a problem with the powershell script execution
@AppVeyorBot
Copy link

@amaitland amaitland linked an issue Dec 15, 2020 that may be closed by this pull request
@AppVeyorBot
Copy link

Not quite sure what the public API should look like as yet, so making internal for now.
@AppVeyorBot
Copy link

@amaitland
Copy link
Member Author

I'm going to merge this now, there's still likely a few issues to resolve. Once AppVeyor creates a new set of packages that'll be easier to test with so will resolve them after merge.

@amaitland amaitland merged commit 8a367fb into cefsharp:master Dec 16, 2020
@amaitland
Copy link
Member Author

The Ref Assemblies don't appear to be build correctly on AppVeyor.

https://ci.appveyor.com/project/cefsharp/cefsharp/builds/36859715/job/lmn6djbvfijk3fui#L591

@Nickman87
Copy link

@amaitland Awesome seeing this work towards the new .Net 5! Are these changes already available somehow trough NuGet to try out?

@amaitland
Copy link
Member Author

@Nickman87 Yes, packages are available on https://www.myget.org/gallery/cefsharp

Issue #3197 has the Net Core/5 specific details, if you can report your findings there that would be greatly appreciated.

This was referenced Dec 31, 2020
amaitland added a commit that referenced this pull request Jan 9, 2021
Updated to reflect changes made in #3311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nuget Package Restructure
3 participants