Search code examples
visual-studio-201564-bitnuget32-bitinstallshield-le

Confusion With Bitness of Application and Installer


I have a Windows Forms Application written in C#. It depends on the NHibernate NuGet package, and I am also writing an InstallShield installer package for this app. All is being done in Visual Studio Community 2015.

Here is my confusion: If I build the application for x64, dumpbin tells me that the app's exe is 64-bit, but NHibernate's DLL and the installer's setup.exe file are still 32-bit. How can a 32-bit installer wrap up my 64-bit app? And why doesn't NHibernate become 64-bit when I build for x64, as I thought NuGet packages were supposed to do? The ultimate question: will my app still run in 64-bit on x64 machines if the installer is 32-bit? Thanks in advance!


Solution

  • A 32-bit installer will not prevent you from installing a 64-bit application; at an oversimplified level, all an Installation does is copy files or registry keys into place.

    However Windows Installer makes it difficult or impossible to install resources to 64-bit locations unless you use a 64-bit package to install it, for example by redirecting from the 64-bit program files folder back to the 32-bit program files folder. That said, InstallShield LE should be creating a 64-bit package automatically if you target, for example, ProgramFiles64Folder or a 64-bit registry key.

    Note that the bitness of a setup.exe and the bitness of the .msi package contained within do not have to match.