Created
December 21, 2020 09:53
-
-
Save jfmaes/9602fccc0805a79eee5ee87d819dd2c9 to your computer and use it in GitHub Desktop.
example ingestor of NvisoLib for the blogpost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NvisoLib; | |
using System.Reflection; | |
namespace AppDomainResolveTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; | |
SomeDLLFunction(); | |
} | |
static void SomeDLLFunction() | |
{ | |
NvisoLib.Test test = new NvisoLib.Test(); | |
test.Say("hi from nvisolib"); | |
} | |
static Assembly ResolveAssembly(object sender, ResolveEventArgs args) | |
{ | |
Assembly asm = null; | |
String name = new AssemblyName(args.Name).Name; | |
Console.WriteLine("attempting to load {0} from an external location.",name); | |
asm = Assembly.LoadFrom(@"C:\Users\jeanm\source\repos\NvisoLib\bin\Release\"+name+".dll"); | |
return asm; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment