简体   繁体   中英

Register .msi (setup project) for both x86 and x64 architectures

I'm building a setup project for a biometric capture application.

The thing is, for it to work on the user's PC, i need to register the .exe path in Regedit.

I'm doing it already by targeting the "Program Files (x86)" folder, as you can see below, but in 32 bit PCs it does not exist, and thus, the application won't start.

在此处输入图片说明

What can I do to make it work for both 32 and 64 bit architectures?

MSI installation does not require executable file registering.

It only can put information into the Windows Registry related to the application removal, etc .

By default MSI installer will put all files into the single root folder (for example, MS Office will be put into "C:\\Program Files\\Office" or to something like this). To configure target installation folder please use TARGETDIR property .

TARGETDIR property is computed during the installation (moreover - it can be overridden by user). Default property "[ProgramFilesFolder]" is x86 location, however it exists everywhere. Property "[ProgramFiles64Folder]" is what you need, however it exists on the x64 OS only.

So, what's you need:

  • Find action/step which will patch TARGETDIR
  • Add action/step before to use "ProgramFiles64Folder" if it exists

Possible this answer can help you with examples.

After the steps above you application will select normal Program Files folder for x86/x64 operating systems.

A couple of things:

  1. Separate MSIs are required for separate architectures: https://blogs.msdn.microsoft.com/heaths/2008/01/15/different-packages-are-required-for-different-processor-architectures/

so if you really need two different builds, one with your 64-bit code and another with your 32-bit code then you need separate MSI builds using the Visual Studio setup project settings. The 32-bit one main folder would be ProgramFilesFolder in the properties of the Application Folder directory, the 64-bit one will use ProgramFiles64Folder.

  1. In both cases, the registry entry you need will be [TARGETDIR]Your.exe and this will just work, based on TARGETDIR being the name for the folder in both cases, and your executable not being in a sub folder.

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