S
Sneil
Situation: I have non-strong-name library _1Lib_.dll and want to load
it in new domain. Startup app - just console app with 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();
}
}
}
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.
it in new domain. Startup app - just console app with 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();
}
}
}
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.