cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
scottd72
Level 7

64-bit release installing files into 32-bit Program Files

In my basic MSI project, under the Files and Folders view I have my [INSTALLDIR] under [ProgramFilesFolder], which is the 32 bit Program Files. This works good when I build 32 bit releases of my project. However, when I build a 64-bit release, all the files get installed to \Program Files(x86) when they should be getting installed to just plain \Program Files.

Is there a way to have Installshield install my files to the correct Program Files location in a 64-bit release?
Labels (1)
0 Kudos
(7) Replies
Shuttledude
Level 7

I can get files to go to "C:\Program Files" on a 64-bit computer by doing this:

1.) Under General Information set INSTALLDIR to [ProgramFiles64Folder]MyCompany\MyApp

(note you use [ProgramFiles64Folder] instead of [ProgramFilesFolder]

2.) Under Template Summary use x64;1033

3.) At least one component must set "64-Bit Component" to Yes (you'll get a compile error if you don't do this).
0 Kudos
scottd72
Level 7

Thanks for the reply.

Here's the problem with doing as you suggested: I need to have both 32 and 64 bit releases in my project file. So, if I have my INSTALLDIR be [ProgramFiles64Folder], then when I build a 32 bit release and install on a 32 bit system nothing under that path gets installed. This is what I have found in my testing.
0 Kudos
skolte
Level 7

Why not check property 'VersionNT64' in your InstallScript in something like OnBegin() or OnFirstUIBefore() event?

If it's true (or property exists) set your INSTALLDIR to be ProgramFiles64Folder, else set it to ProgramFiles.
0 Kudos
scottd72
Level 7

skolte wrote:
Why not check property 'VersionNT64' in your InstallScript in something like OnBegin() or OnFirstUIBefore() event?

If it's true (or property exists) set your INSTALLDIR to be ProgramFiles64Folder, else set it to ProgramFiles.


Hi skolte,

This is a basic MSI project, so I do not have those functions that you mention. I have found a solution that suites my needs. In the Files and Folders view, instead of putting all of my files under ProgramFilesFolder, I created my own folder called PROGRAMFILESFOLDER. Then I created 2 set Directory custom actions SetPROGRAMFILESFOLDERx86 and SetPROGRAMFILESFOLDERx64. For SetPROGRAMFILESFOLDERx86 I used NOT VersionNT64 for the condition and for SetPROGRAMFILESFOLDERx64 I used VersionNT64 for the condition, and put them after CostFinalize. In each I set PROGRAMFILESFOLDER to either [ProgramFilesFolder] or [ProgramFiles6Folder] depending on the custom action. I have them in both UI and execute sequence.

My concern was that if I ran the install silently and used the parameter INSTALLDIR="c:\TEST", the custom action would overwrite that value and install into the program files folder instead. But in my testing this is not the case. It works exactly how I need it to work.
0 Kudos
skolte
Level 7

I thought you would be able to override those events even in Basic MSI. If not, still you can use an InstallScript function that recognizes the OS platform and then set the INSTALLDIR accordingly. Just need to call this function from your custom action.

The approach you described seems a bit more work than needed. Here's a sample that I could put together in less than 15 mins to do what you want, and I am using Basic MSI. Take a look... let me know if you have any questions.
0 Kudos
scottd72
Level 7

I've looked at your project, and although i haven't tested it, it seems it may not suit all of my needs. It seems that if you run your project in silent mode with INSTALLDIR=C:\TEST, the INSTALLDIR property is going to get overwritten when it goes into MyFunction.

Thank you for sharing that with me.
0 Kudos
skolte
Level 7

No problem. I am glad that you already have it working the way you want.. I just wanted to give an alternative that I could think of.

By the way just for your info, to detect SILENT MODE in InstallScript, you need to simply modify my earlier code and add one more check such as

if( MODE != SILENTMODE) then
//Your logic for FULL UI here
else
//Your logic for Silent Mode here
endif;
0 Kudos