The problem: I have an executable and mylib.dll (C# class library) in the same directory. I have a subdirectory "Patch" in that directory containing another version of that mylib.dll. I need to make a sample application somehow that loads the first dll, than frees it (like LoadLibrary and FreeLibrary in Windows API, but here I use Domain.Load, Domain.Unload), and then loads another version of that dll from "Patch" folder.
1) when I try to load the library from "Patch" directory, the library from the application directory is loaded (even if I add some other paths to domain),
2) if I rename "Patch\mylib.dll" to "Patch\mylib1.dll" and try to load the second, renamed one, it is anyway resolved to its original name and again - assembly from mylib.dll in application directory is loaded,
3) if I unload (free) mylib.dll, delete it from my computer, move "Patch\mylib.dll" to "mylib.dll", load it....... I anyway get the original dll that I deleted... it seems like there is hash,
4) changing "patched" dll version doesn't help - I anyway get the original dll if I loaded it once.
Help me! I'm a novice in these things. How could work with dynamic labraries that was so simple in Windows API become so terribly complicated here, in .NET???
What do I do wrong? How can I free the library and load the new, changed one, but with the same name?