1

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
Community
  • 1
  • 1
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126

2 Answers2

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.

Community
  • 1
  • 1
slugster
  • 49,403
  • 14
  • 95
  • 145
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.

Mark Hall
  • 53,938
  • 9
  • 94
  • 111
  • I use sqlite that have 2 editions. One for 32 bit and another for 54 bit – Afshar Mohebi Dec 27 '12 at 05:22
  • @afsharm That is well an good, though since you said you do not use anything x64 specific I would probably still compile for x86. – Mark Hall Dec 27 '12 at 05:40
  • Yes we do not need any specific x64 feature. We just want our simple app to run in both x32 and x64 environment. I must give a try to x86 compile option. – Afshar Mohebi Dec 27 '12 at 05:43