Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

converting .net application 32 bit to 64 bit

I have got a .net application,

  • Class library (Target Platform set to Any CPU)
  • Winform Application (Target platform set to Any CPU)
  • Installer (Target Platform set to X86 and Detected dependencies set for .net framework(x86))

Now when I install this application through setup.exe on a 64-bit machine, it is installed in the Program Files [x86] folder; I guess this is WoW64 feature of emulating 32-bit environment on a 64-bit application.

Now when a client asks to convert it to 64-bit, why does it matter to him if the 32-bit version itself works fine through WoW64? would converting it to 64 bit result in performance benefits?

And when I try to convert it to 64-bit, do I need to change it for all, ie ,

  • Class Library (change Target platform to 64) (What if I skip this step?)
  • Winform Application (change target platform to 64) (What if I skip this too?)
  • Installer (change target platform to 64) [Detected dependencies listing doesn't show any .NET framework x64 option, why?]

Please suggest.

like image 869
EagerToLearn Avatar asked Aug 16 '11 10:08

EagerToLearn


People also ask

Is .NET 32 or 64-bit?

NET Framework 1.0 or 1.1 are treated as 32-bit applications on a 64-bit operating system and are always executed under WOW64 and the 32-bit common language runtime (CLR). 32-bit applications that are built on the . NET Framework 4 or later versions also run under WOW64 on 64-bit systems.

How do I run Visual Studio in 64-bit mode?

From the Visual Studio menu, choose Test, then choose Processor Architecture for AnyCPU projects. Choose x64 to run the tests as a 64-bit process.


2 Answers

No conversion is necessary, your app already runs as a 64-bit process. Because you used AnyCPU on the EXE project. You installed it to the wrong folder but that doesn't matter much if no other process tries to start yours programmatically. That's exceedingly rare.

Verify this from TaskMgr.exe, Processes tab. A 32-bit process has *32 after its process name.

Make your client happy by changing the Setup project's TargetPlatform setting to x64 so it gets installed in c:\program files. Takes you a few minutes.

like image 66
Hans Passant Avatar answered Oct 10 '22 00:10

Hans Passant


You can leave the .NET code projects on AnyCPU, however to install onto 64-bit without hitting the 32-bit WOW stuff you need to change the installer project property that you mention.

If you have custom actions in the installer, these may not work when you change to 64-bit. You might get a BadImageFormatException. To resolve this, you need to faff with the resulting MSI:

http://adamhouldsworth.blogspot.com/2010/10/64bit-custom-actions.html

It won't make much of a difference to the client if your application is standalone. There is no free performance benefit, other than access to more RAM, when going to 64-bit (though the JIT has different types of optimisations available).

The only situation I've seen where 64-bit is required is when you consume that DLL in another application, you cannot mix bit-ness in a single process.

Update: perhaps the lack of a 64-bit framework prerequisite is because you are using VS 2005?

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/7b00f4e9-64e3-4fb6-9906-880820ecda92

like image 21
Adam Houldsworth Avatar answered Oct 10 '22 00:10

Adam Houldsworth