Search code examples
c#deploymentx8664-bitanycpu

C# deployment on whatever machine X86, X64 or AnyCpu


I am a C# programmer. In my company we develop a program that, with a single executable, is deployed on various machines. My boss says that the only way to do that is to make a X86 executable that if working on X86 machines will surely work on X64 too. So I would like to know: is this the correct? And what are the drawbacks of having the same exe working on X86/X64. In any case what's the AnyCpu setting for.

Additionally since most of the IT companies diversify in X86/X64 wouldn't it be better?

Thanks Patrick


Solution

  • In the build/debug options in Visual Studio you can select Any CPU in the Platform target. This makes sure your exe can run on both. For programming: Make sure you check the operating system version in your code when accessing the registry.