【发布时间】:2011-07-08 15:21:56
【问题描述】:
我使用 c# 4.0 和一个控制台应用程序仅用于测试,以下代码确实给出了异常。
AppDomainSetup appSetup = new AppDomainSetup()
{
ApplicationName = "PluginsDomain",
ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
PrivateBinPath = @"Plugins",
ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
};
AppDomain appDomain = AppDomain.CreateDomain("PluginsDomain", null, appSetup);
AssemblyName assemblyName = AssemblyName.GetAssemblyName(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", "sample.dll"));
Assembly assembly = appDomain.Load(assemblyName); //This gives an exception of File not found
AppDomain.Unload(appDomain);
在我创建的 AppDomain 上使用 Load 时,我不断收到 File not found 异常。
谢谢。
【问题讨论】:
-
@danyolgiax,那里提供的解决方案没有使用新创建的应用程序域,他只是使用了 Assembly.LoadFrom 我猜它会将它加载到当前的应用程序域中,这不是我想要的,除非我错了关于某事,无论如何。
标签: c# appdomain appdomainsetup