I am using a 3rd party library that provides separate x86 and x64 assemblies (with the same API). I want to compile my main executable once as AnyCPU, and let the loader select the correct version of the library to load at runtime. Is this possible?
I am aware that there is a way to automatically select the correct version at compile-time. However, this means I have to distribute two versions of my executable, which I don't want.
What I do not want:
MyApp64/
MyApp64.exe
Library64.dll
MyApp32/
MyApp32.exe
Library32.dll
What I do want:
MyApp/
MyApp.exe (AnyCPU)
Library32.dll <-- loaded on 32-bit OS
Library64.dll <-- loaded on 64-bit OS