I'm using an AppDomain to dynamically load/unload a dll called Logic.dll, which is in the Foo subfolder of my app. Here's my code:
public static class Wrapper
{
    private static AppDomain domain = null;
    public static Assembly MyResolveEventHandler(object sender, ResolveEventArgs e)
    {
        return Assembly.LoadFrom(e.Name);
    }
    public static void Initialize()
    {
        if (domain != null)
        {
            AppDomain.Unload(domain);
        }
        try
        {
            string path = Environment.CurrentDirectory + "\\Foo\\";
            AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
            setup.PrivateBinPath = "Foo";                
            domain = AppDomain.CreateDomain("MyDomain", null, setup);
            domain.AssemblyResolve += MyResolveEventHandler;
            DirectoryInfo info = new DirectoryInfo(path);
            foreach (FileInfo file in info.GetFiles("*.dll"))
            {
                string[] filePathStrings = file.FullName.Split('\\');
                string fileName = filePathStrings[filePathStrings.Length - 1];
                if (fileName.Split('.')[0] == "Logic")
                {
                    domain.Load(fileName.Replace(".dll", ""));
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }            
    }        
}
When I run this code, I get a FileNotFound exception: Could not load file or assembly 'Logic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Using fuslogvw.exe to debug, I'm finding that the AppDomain's private path is null, even though I set it in the code:
=== Pre-bind state information ===
LOG: DisplayName = Logic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/MyApp/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApp
Calling assembly : (Unknown).
===
Is there a reason why the appDomain private path is being nullified?
P.S. I can't use the app.config to change the Probing value, since that causes other problems that I can't get around.