I have a C# project build with AnyCPU. We also dynamically load a feature which currently relies on 32 bit native DLLs. With this feature switched off the application runs quite happily as a 64 bit application. Consequently, Visual Studio determines that the application will run in a 64 bit process. To force the application to run as a 32 bit process we have a Post Build step on the main project which uses CorFlags to set it 32 bit. This works fine when running the application outside of Visual Studio. However, if I debug the application by using F5 I get an error indicating that I have a 32/64 bit mismatch. It appears as though Visual Studio has determined that the application can run as a 64 bit process and sets up the debugger accordingly, unaware that I have run CorFlags to force it to 32 bit.
Is there any way to force Visual Studio to debug the application as a 32 bit process? I would like to leave the platform target as AnyCPU as the third party components will eventually be upgraded to 64 bit.