3 using System
.Reflection
;
7 public static int Main ()
9 AppDomain
.CurrentDomain
.AssemblyResolve
+= new ResolveEventHandler (MyResolveEventHandler
);
12 var a
= Assembly
.Load ("Test");
13 foreach (Type t
in a
.GetTypes ()) {
14 Console
.WriteLine ("pp: " + t
+ " " + t
.BaseType
);
16 } catch (Exception ex
) {
17 Console
.WriteLine ("Caught exception: {0}", ex
);
24 static Assembly
MyResolveEventHandler (object sender
, ResolveEventArgs args
)
26 if (args
.Name
== "Test" && args
.RequestingAssembly
== null)
27 return Assembly
.LoadFile (Path
.Combine (Directory
.GetCurrentDirectory (), "assemblyresolve_deps", "Test.dll"));
28 if (args
.Name
== "TestBase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" && args
.RequestingAssembly
.GetName ().Name
== "Test")
29 return Assembly
.LoadFile (Path
.Combine (Directory
.GetCurrentDirectory (), "assemblyresolve_deps", "TestBase.dll"));
31 throw new InvalidOperationException (String
.Format ("Unexpected parameter combination Name=\"{0}\" RequestingAssembly=\"{1}\"", args
.Name
, args
.RequestingAssembly
));