converting .net application 32 bit to 64 bit

22,258

Solution 1

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.

Solution 2

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

Solution 3

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.

Solution 4

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.

Share:
22,258
EagerToLearn
Author by

EagerToLearn

Updated on December 23, 2020

Comments

  • EagerToLearn
    EagerToLearn over 3 years

    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.

  • EagerToLearn
    EagerToLearn almost 13 years
    but why don't i see .NET Framework 2.0 (64-bit) option in Detected Dependencies dialog box?
  • Adam Houldsworth
    Adam Houldsworth almost 13 years
    @EagerToLearn without a project in front of me with an installer in it, I can't really answer that - sorry.
  • EagerToLearn
    EagerToLearn almost 13 years
    And what about .NET Framework dependency, i don't see any option for .NET framework 2.0 (64 bit) in Detected dependencies dialog
  • EagerToLearn
    EagerToLearn almost 13 years
    My dev machine is 32-bit, and when creating installer for a 64-bit application i don't see that option for .NET framework 2.0 (64 bit) in Detected dependencies dialog. What should i do for that
  • EagerToLearn
    EagerToLearn almost 13 years
    When creating a 64-bit installer, shouldn't i expect to see an option for .NET Framework 2.0 (x64) in PREREQUISITES dialog box?
  • Adam Houldsworth
    Adam Houldsworth almost 13 years
    @EagerToLearn I'd assume so, but then again I don't know if the .NET Framework 2 prerequisite assumes a bit-ness.
  • EagerToLearn
    EagerToLearn almost 13 years
    Yes i see the process name doesn't have any *32, even if target platform is anycpu. But how's it that prerequisite is .net framework 2.0 (x86) and still it's running as 64 bit.
  • EagerToLearn
    EagerToLearn almost 13 years
    I'm using visual studio 2008, but application is built on 2.0 framework
  • user1703401
    user1703401 almost 13 years
    That's because the installer for .NET 2.0 that's on your machine only can install the x86 version. Be sure to select .NET 3.5 SP1 instead, it creates a much smaller installer. It uses the Internet to download .NET, if necessary. A 64-bit version of Windows already has .NET pre-installed btw so unticking the dependency is fine too. And the reason no x64 installer is available.