16

I am building an MSI installer with WiX and I am using the WixUI_Advanced. The definition of my ApplicationFolder looks like this, following the advice in another SO answer (WiX tricks and tips).

  <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="$(var.PlatformProgramFilesFolder)">
        <Directory Id="APPLICATIONFOLDER" Name="$(var.InstallName)">

I now want to give the user the option to do a silent install and pass the ApplicationFolder name on the path, either relative to the appropriate program files folder or absolute.

I know that I can pass public property values on the command-line of msiexec, but how do I use that as value for ApplicationFolder and how do I set this up for absolute vs relative paths.

Community
  • 1
  • 1
Jeroen Huinink
  • 1,947
  • 3
  • 17
  • 31

1 Answers1

21

You just define the property on the command line when running msiexec:

msiexec /i product.msi APPLICATIONFOLDER="C:\Program Files\Company\Product\"

The files will be installed into "C:\Program Files\Company\Product" directory.

I'd advice using absolute path here. A relative path may lead to unexpected results.

Alexey Ivanov
  • 11,541
  • 4
  • 39
  • 68
  • This works when I do a /quiet install, but when I do an interactive install and press the advanced button on the licence screen I do not see my specified APPLICATIONFOLDER show up in the directory selection dialog. I expect/want it to show up there as well. – Jeroen Huinink Jun 13 '11 at 11:45
  • 2
    @Jeroen I see. I can suggest using MSI verbose log to find why the value of APPLICATIONFOLDER is modified and where. Run your package as `msiexec /i package.msi /lv*x log.txt APPLICATIONFOLDER="C:\Program Files\Company\Product\"`. Then search the log for `APPLICATIONFOLDER`, you'll see when it's modified. (Sorry it took me a while.) – Alexey Ivanov Jun 15 '11 at 18:00