tags:

views:

192

answers:

3

I want to make existing .NET applications (WinForms and WebForms) run on 64-bit machines, optimized to take advantage of more memory available on 64-bit machines. What do I need to do to the applications to take advantage of the memory? Do I just select the target CPU as 64-bit? What is the advantage of selecting the target versus just compiling the app for All CPUs and have the .NET optimize the app locally?

Will Crystal Reports (in VS 2008) run optimized for 64-bit and take advantage of the upper memory?

+6  A: 

You can set the target CPU to "AnyCPU". This will JIT to x86 code on x86 machines and x64 code on x64 machines. Keep in mind that any unmanaged DLL's you reference will very likely cause problems. I have no idea if Crystal Reports takes any dependencies on unmanaged DLL's (it used to be a thin wrapper over ActiveX crap, not sure about now.)

If your application only references managed code that is compiled for AnyCPU you should be fine.

There is no real "advantage" to specifying the CPU architecture up front. It's a way to deal with the fact that you may need to ensure that the application only JIT's to one particular architecture. For example, if you use the Microsoft Jet OLEDB provider and your application is compiled for AnyCPU, on a x64 OS it will fail at runtime because it will run as a x64 process and there is no x64 OLEDB driver for Jet.

In this case, you could force it to target x86 then even on an x64 OS, the application would still JIT to x86.

Josh Einstein
+1 - much better than mine
Michael Shimmins
I thought .Net Framework runs using WOW on 64bit boxes
Chris Bednarski
@KNoodles, no there is a x64 framework. If the entry assembly is compiled for x86 then the whole thing will run in WoW obviously. But the default is to JIT to x64. At least it was until VS 2010 which now defaults to x86 in order to hide the fact that Intellitrace doesn't work in x64. Bleh.
Josh Einstein
@Josh: I thought it only JITs to x86 when started from the debugger?
Simon Buchan
@Simon, It may be x86 in the DEBUG configuration and AnyCPU in Release I'm not sure. However, it isn't dependent on whether or not it's started from the debugger. The build output of an EXE project by default in 2010 is x86.
Josh Einstein
A: 

Unless you need conditional compilation to be able to swap out third part components that require native support on different architectures, I would generally recommend leaving it up to the runtime (Any CPU).

The framework on the target machine will take care of it and it makes your life easier rather than having to manage build configuration for various environments.

Michael Shimmins
A: 

There are 2 flavors of CR runtime:

  • Crystal Reports (full version runtime)
  • Crystal Reports Basic (bundles with VS 2005, 2008)

Your 64-bit support will depend on which version you choose for your application.

There are no 64-bit dlls for Crystal Reports XI Release 2 or Crystal Reports 2008. Only the .NET 2005 (CR 10.2) and .NET 2008 (CR 10.5) bundles (CR Basic) are 64-bit. If you need to use the complete Crystal Reports runtime for CR XI or CR 2008 you have to compile your app in 32-bit mode (x86).

SAP link 1

SAP link 2

ArtOfCoding