diff --git a/pythonnet/src/console/pythonconsole.cs b/pythonnet/src/console/pythonconsole.cs
index 9a58525b1..2184c8730 100644
--- a/pythonnet/src/console/pythonconsole.cs
+++ b/pythonnet/src/console/pythonconsole.cs
@@ -8,6 +8,7 @@
// ==========================================================================
using System;
+using System.Reflection;
using Python.Runtime;
namespace Python.Runtime {
@@ -27,6 +28,30 @@ public static int Main(string[] args) {
return i;
}
-}
+ // Register a callback function to load embedded assmeblies.
+ // (Python.Runtime.dll is included as a resource)
+ private sealed class AssemblyLoader {
+ public AssemblyLoader() {
+ AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
+ String resourceName = new AssemblyName(args.Name).Name + ".dll";
+
+ // looks for the assembly from the resources and load it
+ using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) {
+ if (stream != null) {
+ Byte[] assemblyData = new Byte[stream.Length];
+ stream.Read(assemblyData, 0, assemblyData.Length);
+ return Assembly.Load(assemblyData);
+ }
+ }
+
+ return null;
+ };
+ }
+ };
+
+ private static AssemblyLoader assemblyLoader = new AssemblyLoader();
+
+};
+
}
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy