Net Core - Fix BrowserSubProcess.SelfHost path lookup

- Add Initializer.BrowserSubProcessCorePath which is calculated the same as BrowserSubProcessPath
- Update SelfHost to use new path then fallback to old path.

Details in https://github.com/cefsharp/CefSharp/issues/3197#issuecomment-757819840
This commit is contained in:
Alex Maitland
2021-01-12 10:47:09 +10:00
parent e5fcb33e8d
commit b5118b5646
2 changed files with 11 additions and 1 deletions
+8 -1
View File
@@ -72,11 +72,18 @@ public class SelfHost
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);
+3
View File
@@ -22,6 +22,7 @@ namespace CefSharp
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 @@ namespace CefSharp
if (LibCefLoaded)
{
BrowserSubProcessPath = Path.Combine(currentFolder, archFolder, "CefSharp.BrowserSubprocess.exe");
BrowserSubProcessCorePath = Path.Combine(currentFolder, archFolder, "CefSharp.BrowserSubprocess.Core.dll");
LibCefPath = libCefPath;
LibCefHandle = handle;
}