views:

67

answers:

2

Mainly I ask this because I don't want to distribute both versions, and if I need to instal a 64bit .NET on an x64 PC and a 32bit .NET on a 32 bit PC then I would need to make this check in my loader application to download the correct version for the correct PC.

However, if I just do a one for all, it would be easier - and i would just like to know if theree is anything I should know before doing this (ie: any repercussions?) or all good?

Also, when I compile an exe in a 64bit version of VS2010 does it compile a 32bit exe by default or a 64bit? I'm presuming 32, but just wanted to make sure.

Thanks.

+3  A: 

If you target AnyCPU for your compilation, the app will run as 64bit on a 64bit OS, and 32bit on a 32bit OS. If you target x86, the app will run as 32bit regardless of the OS. If you target x64, the app will only run on a 64bit OS.

The 64bit version of .Net also includes the 32bit dll's.

If you have to install the runtime from the Internet, then use the web installer. It will take care of downloading and installing the correct version on the client. This way you can target AnyCPU (or x86) and be certain that the app will run regardless of the OS.

If you need to package .Net with your app, download the full file which has both 32/64bit versions included - http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe

Client profile web install

Client profile full install

Silent install can be done with the /q parameter and you might want to add /norestart as well and handle reboot yourself if necessary.

Check out this blog post and the MSDN documentation on what switches are available.

Mikael Svenson
Is there a client profile version of the packaged file you listed and can this be run or installed silently?
Erx_VB.NExT.Coder
Yes, and I've added links to them. Also @Hans comment about hooking off pre-req in the installer project is a great tip.
Mikael Svenson
@mikael, thank you for your answer, i was wondering if i could run a .NET exe right after installing the .NET 4.0 CP without rebooting? this would be great if it is possible.
Erx_VB.NExT.Coder
In most situations, .NET Framework doesn’t require reboot after install. But if some of the system files are occupied and .NET Framework cannot replace them, it may require reboot.
Mikael Svenson
+2  A: 

The .NET bootstrapper automatically installs both the 32-bit and the 64-bit versions of the .NET framework on a machine with a 64-bit operating system. Nothing you have to do to tell it to do so. Avoid distributing the .NET framework yourself, you'll have a hard time keeping up with the security updates. Just tick the option in the Setup project's Prerequisites to get the bootstrapper, that will download the latest and greatest during install on the target machine, if necessary. The option is automatically ticked when you create an installer for a managed program.

There is no 64-bit version of VS2010, no need to worry about that.

The Platform Target setting in the Project + Properties, Build tab for your EXE project is relevant. It defaults to x86 in a project that was created from scratch in VS2010. There is no great reason to change it to AnyCPU for the Release build unless you need the extra virtual memory space that a 64-bit process can provide. If you do change it then do make sure to test it thoroughly. I know you've been tinkering with unmanaged COM servers, x86 is probably a hard requirement.

Hans Passant
@hans, thank you for your answer, brilliant! what i was going to do was download and instal the .net 4.0 client profile from vb6 app, and then download and copy .net exe (my actual app/program) to the computer without reboot. since this all needs to be done silently to not hassle the users. if i created a package as you suggested, can that execute a full silent instal of both the .NET 4.0 CP and my app? (my app only needs to be copied to a particular directory, nothing else like icons/registry stuff are needed as they all already exist)...
Erx_VB.NExT.Coder
The days of secretly installing stuff behind the user's back, especially something as impactful as a .NET framework version are long, long gone. You are not taking your user's concern for her machine's stability seriously enough, I'm not going to help you find a back door. I seriously doubt that one exists.
Hans Passant
Most MS installers support silent installs. For example look at the new prereq installer with SharePoint 2010 which downloads and silently installs a bunch of things needed. That said, Office in different versions also bundle .Net, as does Vista/Windows7. So on a moderately new machine .Net is already there. Upgrading it silently to v4 wouldn't be that bad imo. But it's better pushed by an admin (at least in an enterprise).
Mikael Svenson
@hans, i'm not looking for a backdoor. i have all the user interface stuff ready, so the user knows exactly what they'll be updating/receiving if they click 'Upgrade', it includes a full description title of the .NET CP and a full description title for my .NET app, if i launch seperate installers for them to click through, it contributes to an inconsisted UI experience for my users, and creates additional steps (clicking/waiting/reading/selecint etc) which is not needed and only complicates the user, especially if they are very new to the PC world.
Erx_VB.NExT.Coder
@hans, i have spent so much effort accouting for UI factors and minimizing complication and steps for users, that doing this any other way would go against that paradigm completely. Having said that, i'm dismayed by your suggestion that I would do anything contrary to the well-being of my users, it hurts even more when it comes from someone that I look up to and respect (such as yourself). Anyway, thank you for your contributions until now, but i've already a method in mind to move forward.
Erx_VB.NExT.Coder
@mikael, thank you for your input, i will take these considerations into account and investigate all that is needed, thanks again.
Erx_VB.NExT.Coder
@hans, i've re-read your and my posts, and am still struggling to figure out how you've come to the impression that i am looking for a backdoor. all i was after was the /q and /noreboot switches, which Mikael kindly offered, and i do not think these switches are considered as backdoors (correct me if i am mistaken), the rest is just basic installation routines either as you suggested (letting packager take care of things) or using the method I had already planned to use and mentioned, which is installing .NET and copying the updated version of my app/exe.
Erx_VB.NExT.Coder