cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Simon_Yang
Level 6

What is the different between set-property custom action and MsiSetProperty

I used a set-property custom action set [INSTALLDIR] as [ProgramFilesFolder]\myfolder. During installing, installer can reslove install directory as c:\program files\myfolder. However, if i used function MsiSetProperty set [INSTALLDIR] to "[ProgramFilesFolder]\myfolder", during installing, installer always complained cannot find path "[ProgramFilesFolder]\myfolder". Seems like, installer cannot resolve [ProgramFilesFolder] in the second way. I didn't why!

How can I solve this problem, if I really want to use some methods just like second way?

Thanks a lot!
Labels (1)
0 Kudos
(4) Replies
ElenaN
Level 6

How about trying to read [ProgramFilesFolder] location from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion – “ProgramFilesDir”
inside you Custom Action and then setting [INSTALLDIR] to “foud_path_variable + “\myfolder”

Or first MsiGetProperty [ProgramFilesFolder] and than use this value inside CA
0 Kudos
Jan_Eggers
Level 4

you can read the value of ProgramFilesFolder with MsiGetProperty

the u need to build the complete string an save this with MsiSetProperty
0 Kudos
Darain
Level 6

might it be
ProgramFilesFolder + "\\myfolder"
instead of
"[ProgramFilesFolder]\myfolder"
0 Kudos
RobertDickau
Flexera Alumni

As an aside, you might want to use a set-a-directory action or MsiSetTargetPath to set INSTALLDIR and other Directory-table properties.

Also, Directory-table entries resolve to a value that ends with a backslash, so you'll generally want [ProgramFilesFolder]subdir instead of [ProgramFilesFolder]\subdir.

If nothing else, MsiFormatRecord will resolve [Formatted] expressions.

Depending on your project type, you can use some Directory identifiers in InstallScript; when concatenating directories, the ^ operator is usually better than +, since you don't have to worry about backslashes between levels.
0 Kudos