DllImport - An attempt was made to load a program with an incorrect format [duplicate]
问题 This question already has an answer here: Loading a 32-bit dll in a 64-bit process [duplicate] 1 answer I want my C# application to conditionally run a native method. Deciding at run time whether to run either the x86 or the x64 version of the dll. This question explains how to choose 32 bit or 64 bit at compile time, but that does not help. I want to make the decision at runtime. I'm currently doing the following: [SuppressUnmanagedCodeSecurity] internal static class MiniDumpMethods {