.net – compling assemblies on a 64bit plaform for a 32bit

32-bit64-bitnetpublishwindows-vista

What option should I select for compliing assemblies on a 64bit plaform for a 32bit platform server. As currently I am trying to publish to a 32bit server. I am using VS2005 on a windows Vista machine to build my project and then publish on server but I am getting errors. Any idea how can I solve this problem.

Should I use AnyCPU option on a 64bit machine or Mixed Platform option. Also option of x86 is disabled and I dont know why.

Best Answer

Assuming you are working in a managed language, then compiling to 'AnyCPU' should be cross-platform (64/32 bit), because the generated IL is not turned into machine instructions until the code is JITted when it is run.

There are a very few exceptions where you can get bit-ness dependencies if you use certain constructs that rely on the size of pointers, etc. but these generally do not come up in your code, although it would not hurt to run FxCop over your code to make sure (there is a section in FxCop dealing with portability that covers these issues)