Skip to content

Commit 4c691f8

Browse files
committed
Assembly load fix for console project.
1 parent ab6ddbc commit 4c691f8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Python.Runtime/Runtime.InitInterop.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public partial class Runtime
2323
{
2424
static Runtime()
2525
{
26-
var binLocation = typeof(Runtime).GetTypeInfo().Assembly.Location;
27-
var interopDllPath = Path.Combine(Path.GetDirectoryName(binLocation), "Python.Runtime.Interop.dll");
28-
InitInterop(interopDllPath);
26+
InitInterop();
2927
}
3028

3129
internal static void InitInterop(IPythonInterop pythonInterop)
@@ -51,13 +49,11 @@ internal static void InitInterop(IPythonInterop pythonInterop)
5149
ObjectOffset.Init();
5250
}
5351

54-
public static void InitInterop(string interopDllPath)
52+
53+
public static void InitInterop()
5554
{
56-
#if NET46
57-
var assembly = Assembly.LoadFrom(interopDllPath);
58-
#else
59-
var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(interopDllPath);
60-
#endif
55+
var assembly = Assembly.Load(new AssemblyName("Python.Runtime.Interop"));
56+
6157
var type = assembly.GetType("Python.Runtime.Interop.PythonInterop");
6258
var pythonInterop = (IPythonInterop)Activator.CreateInstance(type);
6359
InitInterop(pythonInterop);

0 commit comments

Comments
 (0)