简体   繁体   中英

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.

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.

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

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 WOW feature of emulating 32-bit environment on a 64- bit application.

No, it has NOTHING to do with the program, only with the installer.

•Installer (Target Platform set to X86 and Detected dependencies set for .net framework(x86))

32 bit installer installes it in the 32 bit folder for programs, regarless whether the program is 32 or 64 bit.

Sadly you can not have one installer doing both - you need an installer for 32 and one for 64 bit in concept, by design.

This is totally a design decision on the MSI part and, again, has nothing to do with the program at all.

64 bit may or may not give performance differences. A 64 bit application can also utilize (way) more memory than a 32bit application.

If you launch an AnyCpu exe on a 64bit OS it should launch in 64bit (see in the task manager, 32bit processes are appended with *32 there). If you set the application to x64, the library must be either x64 or AnyCpu.

If you do not have native x64-only references you can leave your exe and dll as AnyCpu, but you will need to modify the setup to x64.

As for the framework, on an x64 machine (which is the only place an x64 app will run anyway), the framework always includes both 32 and 64 bit, found in C:\Windows\Microsoft.NET\Framework and Framework64 respectively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM