Here's how I did it when we couldn't change the existing code from any CPU to x86 due to ClickOnce restriction:
Create 32-bit (x86 should be checked in the project properties) Application "launcher" (Windows application, but not form):
static void Main(string[] args) {
Add the following code to the Main method in the Any CPU project:
if (IntPtr.Size == 4) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // etc... } else { // Launch application in 32-bit mode System.Diagnostics.Process.Start(Path.GetDirectoryName(Application.ExecutablePath) + @"\Your32BitApplicationLauncher.exe"); }
Hope this helps :-)
Campbell Jan 15 '10 at 2:15 2010-01-15 02:15
source share