-1

I wrote a simple lines of creating separate AppDomain, but getting strange exception of FileNotFound : Could not load file or assembly... Considering necessary parameters are filled , this issue is very confusing to me:

AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = Assembly.GetExecutingAssembly().CodeBase;
Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);
evidence.AddAssembly(Assembly.GetExecutingAssembly().FullName);
evidence.AddHost(new Zone(SecurityZone.MyComputer));
AppDomain hostedAppDomain = AppDomain.CreateDomain("Demo", evidence, setup);                   
hostedAppDomain.AssemblyResolve += new ResolveEventHandler(hostedAppDomain_AssemblyResolve);   **// Exception in this line**
Shelest
  • 660
  • 8
  • 19

1 Answers1

0

Figured out.. need to change

setup.ApplicationBase = Assembly.GetExecutingAssembly().CodeBase;

to

setup.ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Shelest
  • 660
  • 8
  • 19