私はついにこれがうまくいくと答えました。
両方をコンパイルします。& 64ビットバージョン - 両方ともアンマネージド&を別々のフォルダに管理します。次に、.NETアプリケーションで実行時にアセンブリをロードするディレクトリを選択させます。
ResolveEventを使用する際の問題は、アセンブリが見つからない場合にのみ呼び出されることです。そのため、すべてが誤って32ビットバージョンで終わるのは簡単です。代わりに、2番目のAppDomainオブジェクトを使用して、ApplicationBaseプロパティを変更して正しいフォルダを指すようにします。だから、あなたは次のようなコードになります:
static void Main(String[] argv)
{
// Create a new AppDomain, but with the base directory set to either the 32-bit or 64-bit
// sub-directories.
AppDomainSetup objADS = new AppDomainSetup();
System.String assemblyDir = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
switch (System.IntPtr.Size)
{
case (4): assemblyDir += "\\win32\\";
break;
case (8): assemblyDir += "\\x64\\";
break;
}
objADS.ApplicationBase = assemblyDir;
// We set the PrivateBinPath to the application directory, so that we can still
// load the platform neutral assemblies from the app directory.
objADS.PrivateBinPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
AppDomain objAD = AppDomain.CreateDomain("", null, objADS);
if (argv.Length > 0)
objAD.ExecuteAssembly(argv[0]);
else
objAD.ExecuteAssembly("MyApplication.exe");
AppDomain.Unload(objAD);
}
最終的に2つのexes - あなたの通常のアプリとロードするビットを選択する第2の切り替えアプリケーション。 注 - 自分自身の詳細については、私は信用できません。私の同僚の一人が、私の最初のポインタを与えて、それを賞賛しました。彼がStackOverflowにサインアップしたら、私は彼に答えを割り当てます