private void PrepareAppDomain() { AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationName = AssemblyName.Name; // Teach the new appdomain where to find the plugin assemblies setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; // Teach the new appdomain where the plugins can find the web server assemblies Uri assemblyPath = new Uri(AssemblyName.CodeBase); setup.PrivateBinPath = Path.GetDirectoryName(assemblyPath.LocalPath); // Shadow-copy assembly to avoid file locking setup.ShadowCopyFiles = "true"; setup.ShadowCopyDirectories = setup.ApplicationBase + ";" + setup.PrivateBinPath; // Create the domain to load the plugin into. AppDomain = AppDomain.CreateDomain(AssemblyName.FullName, PluginEvidence, setup); AppDomainExceptionHandler errorHandler = new AppDomainExceptionHandler(AppDomain); errorHandler.Attach(); }
private void PrepareAppDomain() { AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationName = AssemblyName.Name; // Teach the new appdomain where to find the plugin assemblies setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; // Teach the new appdomain where the plugins can find the web server assemblies Uri assemblyPath = new Uri( AssemblyName.CodeBase ); setup.PrivateBinPath = Path.GetDirectoryName(assemblyPath.LocalPath); // Shadow-copy assembly to avoid file locking setup.ShadowCopyFiles = "true"; setup.ShadowCopyDirectories = setup.ApplicationBase + ";" + setup.PrivateBinPath; // Create the domain to load the plugin into. AppDomain = AppDomain.CreateDomain(AssemblyName.FullName, PluginEvidence, setup ); AppDomainExceptionHandler errorHandler = new AppDomainExceptionHandler(AppDomain); errorHandler.Attach(); }