Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows setup/installer project: Forcing installation into "Program Files", not x86?

My boss needs an installer to setup software onto one of our client's machines. He wants the software to be installed specifically into "C:\Program Files\HisApplicationName", not "C:\Program Files (x86)\HisApplicationName". I know the correct answer would be to rewrite the software to accomodate any directory the user chooses to install to, but unfortunately, this is very old sofware & needs to be installed tomorrow, so we just want to force the installer to point to the client's "Program Files" directory.

My problem though, is when I hardcode the filepath into the installer's "DefaultLocation" property, the installer still tries to point to the Program Files (x86) directory instead.

Is there any way to force the windows setup/installer package to point to Program Files & not "Program Files (x86)"?

Thanks.

like image 384
goalie35 Avatar asked Dec 04 '22 04:12

goalie35


1 Answers

What you are asking to do simply isn't possible with Windows Installer with the exception of one unsupported subversive hack.

Set the INSTALLDIR to C:\Progra~1\.....

See, MSI has functionality for backwards compatibility that automatically "fixes" any hard coded references of C:\Program Files\ to C:\Program Files (X86) when the MSI is marked as 32 bit. It fails to calculate the shortname version and redirect it so my hack works. Assuming they haven't disabled short filename system.

The only proper way to install to C:\Program Files is to mark the MSI as 64-bit and use the ProgramFiles64Folder property instead of the ProgramFilesFolder property.

BTW, if your boss won't believe you, then I suggest finding a new boss. I've been writing installers for 16 years and I never let some PHB make decisions like this. I'm the Windows Installer expert, not him.

like image 107
Christopher Painter Avatar answered Dec 29 '22 10:12

Christopher Painter