diff --git a/CefSharp.Core/BrowserSubprocess/SelfHost.cs b/CefSharp.Core/BrowserSubprocess/SelfHost.cs index 287293521e..33e966dd27 100644 --- a/CefSharp.Core/BrowserSubprocess/SelfHost.cs +++ b/CefSharp.Core/BrowserSubprocess/SelfHost.cs @@ -72,11 +72,18 @@ public static int Main(string[] args) return -1; } - var browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll"); + #if NETCOREAPP + var browserSubprocessDllPath = Initializer.BrowserSubProcessCorePath; + if (!File.Exists(browserSubprocessDllPath)) + { + browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll"); + } var browserSubprocessDll = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(browserSubprocessDllPath); #else + var browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll"); var browserSubprocessDll = System.Reflection.Assembly.LoadFrom(browserSubprocessDllPath); + #endif var browserSubprocessExecutableType = browserSubprocessDll.GetType("CefSharp.BrowserSubprocess.BrowserSubprocessExecutable"); var browserSubprocessExecutable = Activator.CreateInstance(browserSubprocessExecutableType); diff --git a/CefSharp.Core/Initializer.cs b/CefSharp.Core/Initializer.cs index 38bf602e5d..d210853328 100644 --- a/CefSharp.Core/Initializer.cs +++ b/CefSharp.Core/Initializer.cs @@ -22,6 +22,7 @@ public static class Initializer internal static bool LibCefLoaded { get; private set; } internal static string LibCefPath { get; private set; } internal static string BrowserSubProcessPath { get; private set; } + internal static string BrowserSubProcessCorePath { get; private set; } [ModuleInitializer] internal static void ModuleInitializer() @@ -49,6 +50,8 @@ internal static void ModuleInitializer() if (LibCefLoaded) { BrowserSubProcessPath = Path.Combine(currentFolder, archFolder, "CefSharp.BrowserSubprocess.exe"); + BrowserSubProcessCorePath = Path.Combine(currentFolder, archFolder, "CefSharp.BrowserSubprocess.Core.dll"); + LibCefPath = libCefPath; LibCefHandle = handle; }