How to avoid 32/64 bit architecture dilemma in Windows and .Net? [duplicate]

落花浮王杯 提交于 2019-12-11 05:05:11

问题


Possible Duplicate:
What does the Visual Studio “Any CPU” target mean?

We have a WPF application that must work on plenty of Windows machines from Windows XP x32 to Windows 8 x64. Our app includes NHibernate and SQLite. We do not need any feature of x64. How can modify application to run without any problem on all architectures?

  • Our app is in .Net 4.0

回答1:


Unless you have both the 64bit and 32 bit dll's of your external dependences I would just compile for the lowest common denominator i.e: x86 it will install and run correctly on both 32 bit and 64 bit versions of windows.




回答2:


Compile it for the AnyCpu architecture, this will make it x86/x64 agnostic.

Of course this won't prevent issues if you are looking to access bitness specific things like %PROGRAMFILES%, if you do this you will still need to test for bitness using the Environment.Is64BitOperatingSystem property.



来源:https://stackoverflow.com/questions/14049600/how-to-avoid-32-64-bit-architecture-dilemma-in-windows-and-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!