Situation: I have non-strong-name library _1Lib.dll and want to load it
in new domain. Startup app - just console app with code:
And how folders organized:
c:\MyDir\_1Main.exe << Startup app
c:\MyDir\P1\_1Lib.dll << Lib I want to load
But code above just thow "System.IO.FileNotFoundException crossed an
AppDomain boundary". Message of exception: "Could not load file or
assembly '_1Lib, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies." But if I move
_1Lib.dll to the c:\MyDir\ (so both _1Main.exe and _1Lib.dll appear
in the same folder) code work just fine. But I really need to place lib
in SUB-folder of MainApp-folder!! Help!!
Thanks.
in new domain. Startup app - just console app with code:
Code:
using System;
using System.Reflection;
namespace _1Main
{
class Program
{
static void Main(string[] args)
{
AppDomainSetup domSetup2 = new AppDomainSetup();
domSetup2.ApplicationBase =
AppDomain.CurrentDomain.BaseDirectory;
domSetup2.PrivateBinPath = "P1";
AppDomain anotherAD2 =
AppDomain.CreateDomain("SecondAppDomain", null, domSetup2);
anotherAD2.Load("_1Lib");
Console.ReadKey();
}
}
}
c:\MyDir\_1Main.exe << Startup app
c:\MyDir\P1\_1Lib.dll << Lib I want to load
But code above just thow "System.IO.FileNotFoundException crossed an
AppDomain boundary". Message of exception: "Could not load file or
assembly '_1Lib, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies." But if I move
_1Lib.dll to the c:\MyDir\ (so both _1Main.exe and _1Lib.dll appear
in the same folder) code work just fine. But I really need to place lib
in SUB-folder of MainApp-folder!! Help!!
Thanks.