compling assemblies on a 64bit plaform for a 32bit

Go To


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.

2009-06-16 08:52
by sam
What kind of errors are you getting on the server - jerryjvl 2009-06-16 08:56
Exception System.NullReferenceException: Object reference not set to an instance of an object. at BP.Generic(Conversation pGalConversation) in C:\Soe\IS\Generic\BP\BP.vb:line 797 at Generic(Conversation pGalConversation - sam 2009-06-16 09:02
By compiling option using AnyCPU. it works well on test server but fails on live serve - sam 2009-06-16 09:06


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)

2009-06-16 08:58
by jerryjvl


Use AnyCPU. As long as your assembly doesn't have any direct unmanaged dependancies or dependancies on assemblies which are marked for a specific CPU then your assembly will work fine on 64 or 32 bit

2009-06-16 08:57
by AnthonyWJones