How can I generate a compiler error if the platform target is not set to x86?
Motivation: A particular method dynamically loads a 32-bit COM dll. If the project is built for "x64" or "Any CPU" and is run in a 64-bit environment, then naturally loading the COM object fails at run time. I want a compile-time check to make sure this can't happen.
This is intended to be a safety check of the project settings, encapsulated entirely in the source file that requires 32-bitness. So I can't accept a solution (such as this) that requires defining a conditional compilation symbol in the project settings.