Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm not sure what's going on but I've just finished writing a C# 4.0 app and now I'm trying to distribute it to run on a few other machines. Everything seemed to going fine until I got to the last machine which is a 32 bit machine. It will install but I won't launch the app.

Does anyone know what's going on here? Then only thing I could think of was - I built the app on a 64 bit platform and the last machine is a 32 bit machine so maybe there's a compatibility issue.
Posted
Updated 14-Apr-11 11:59am
v2

1 solution

In 64-bit Windows there are two Registries.
These are;
A registry for 32-bit applications, and the other for 64-bit applications. It’s structured so that a 64-bit applications accessing HKLM\Software\Foo will access the 64-bit Registry, and a 32-bit app using the exact same path will access the 32-bit Registry instead.

I think your application by default is running in 64-bit mode on 64-bit versions of Windows. This means that it will be accessing the 64-bit Registry, and will only be able to talk to 64-bit libraries.

If all you’re trying to do are simple things like reading/writing paths from the Registry just change your Registry code (that wants to get to the 32-bit Registry) to access HKLM\Software\Wow6432Node\Foo instead of HKLM\Software\Foo.

-or-

You may want to deploy your project for any cpu;

*AnyCPU - executed in 32bit on a 32bit runtime and 64bit on a 64bit runtime
*x86 - forced to execute in 32bit
*x64 - forced to execute in 64bit (will not work on 32bit OS)
*(IA64 - Itanumim)


So in order to do that you should change your deployment settings;

"Target Plattform" is in both cases "Any CPU" and also in the configuration manager all the project of the solutions should be set to "Any CPU".

Also sometimes problems may occur if you use unsafe constructs(ex: PInvoke) or if you specifically build your assemblies for a target platform.
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900