cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AndrewRich
Level 5

Custom-install value of INSTALLDIR

Basic MSI project in InstallShield 2011.

There's a need to set some user environment variables. Under System Configuration -> Environment Variables, I configured the name and value. The value needs to be a subdirectory named "SDK" under the installed directory so I set it to "[INSTALLDIR]SDK". This works fine as long as the user doesn't change the default install directory. If they do, the environment variable is still set to the default instead of the custom.

I tried using an InstallScript custom action, setting the environment variable into the "Environment" key of HKEY_CURRENT_USER. The values are set (let's hear it for InstallScript) but again, it always uses the default value of INSTALLDIR even if I choose a custom install directory.

What is the proper way to specify the true value of INSTALLDIR whether customized or default?


By the way, Hi everyone. I'm back. Again.
Labels (1)
0 Kudos
(8) Replies
TsungH
Level 12

A screenshot of Environment Variables view with the environment variable in question and Directory table may shed some light on the behavior. And a verbose installation log will be helpful too.
0 Kudos
AndrewRich
Level 5

Screenshots attached.

I may be a grizzled veteran with InstallScript, but I'm admittedly pretty raw with MSI projects. Any help is appreciated.
0 Kudos
TsungH
Level 12

They look correct. I just tried it w/ a skeleton project (IS2011 Basic MSI) and it works as expected, default value and not.

Without verbose installation log, one will need to know whether it is INSTALLDIR or NEW_DIRECTORY1 that's changed; and how and when in sequence the property is changed during installation.
0 Kudos
AndrewRich
Level 5

Could you let me know how to generate the installation log?
0 Kudos
TsungH
Level 12

For Basic MSI, you can pass your .msi file to msiexec.exe as a parameter. Use double quotes if there is whitespace in the path.

msiexec.exe /i \your.msi /l*vx \verbose.log
0 Kudos
AndrewRich
Level 5

TsungH wrote:
For Basic MSI, you can pass your .msi file to msiexec.exe as a parameter. Use double quotes if there is whitespace in the path.

msiexec.exe /i \your.msi /l*vx \verbose.log


Thanks. I've attached verboselog.txt. Interestingly, I can't find a mention of changing the value of INSTALLDIR when I change it in the "Custom Install" dialog. The secondary INSTALLDIR from an included merge module is changed but not the primary one. However, all the files are installed to the location I selected.
0 Kudos
AndrewRich
Level 5

Solved. The project had been designed such that the base target directory was never exposed in the Custom Install. Only the sub-features' target directories could be changed. Since changing those targets didn't change INSTALLDIR, it makes sense that later references to INSTALLDIR would use the default value.

I solved it by adding a base feature to the project, moving the other features below it and removing the ability to change the target directory for the sub-features.

Thanks for your help.
0 Kudos
TsungH
Level 12

I am a little late, got tied up by work. Glad that you have solved it.
0 Kudos