私の目的は、指定された 2 つのフォルダー間で欠落している依存関係のチェックを行うことです。次の設定を想像してください。
ルート\DirA\A.dll
ルート\DirB\B.dll
B は A に依存します。
したがって、これらのフォルダーを指定して、新しい AppDomain を作成し、B.dll をロードして、DirA(A.dll) からの依存関係を自動的に解決し、その新しい AppDomain で分離します。
この AppDomain をアンロードするときに、潜在的に DirA を依存関係として持つ新しいものを作成したいのですが、それを必要とする DirC ライブラリがあるため、DirC が DirB にも依存している場合は、分離が重要です。例外。
編集:私の質問をよりよく説明するのに役立つ場合に備えて、コード例を追加します。
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = @"C:\Root";
setup.ApplicationName = "Isolated Domain"
setup.PrivateBinPath = @"DirA;DirB";
setup.PrivateBinPathProbe = "";//disable search in AppBase..
var domain = AppDomain.CreateDomain(Guid.NewGuid().ToString(),
AppDomain.CurrentDomain.Evidence,
setup,
AppDomain.CurrentDomain.PermissionSet);
//The following statement in theory should pick B.dll's dependency from DirA.
var assembly = domain.Load(AssemblyName.GetAssemblyName(@"C:\Root\DirB\B.dll").Name);
//Do the same in a different domain for C.dll
それについて助けてくれてありがとう。