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 var path
= Path
.Combine (Directory
.GetCurrentDirectory (), "assemblyresolve", "deps");
27 if (args
.Name
== "test" && args
.RequestingAssembly
== null)
28 return Assembly
.LoadFile (Path
.Combine (path
, "test.dll"));
29 if (args
.Name
== "TestBase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" && args
.RequestingAssembly
.GetName ().Name
== "test")
30 return Assembly
.LoadFile (Path
.Combine (path
, "TestBase.dll"));
32 throw new InvalidOperationException (String
.Format ("Unexpected parameter combination {0} {1}", args
.Name
, args
.RequestingAssembly
));