Wix - Setting Install Folder correctly

I have finally figured out the problem. After searching for a while, I came across this document:

WixUI_InstallDir Dialog Set

The relevant part: "The directory ID must be all uppercase characters because it must be passed from the UI to the execute sequence to take effect."

And as you can see in my code: "Myapp_Installer_Dir" does not meet this criteria.

After changing it to "MYAPPINSTALLERDIR", everything worked.


I'm not quite sure, but this is what I think has happened.

When you author a SetDirectory element, you basically add a custom action which sets a directory to the MSI database. As long as you do not specify the sequence it is executed in, it defaults to both, which means execute in both InstallUISequence and InstallExecuteSequence.

Now, when a user changes the installation directory in the wizard, this happens in the UI sequence. Obviously, when the installation enters the execute sequence, the value of INSTALLFOLDER is set to [WindowsVolume]Myapp as it was instructed.

So, you have to rework this somehow. Keep in mind the silent installation as well - there's only execute sequence there.

UPDATE instead of what you have, try something like this:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="WindowsVolume">
    <Directory Id="INSTALLFOLDER" Name="Myapp">
      <Directory Id="BIN" Name="Bin" />
      <Directory Id="ICONS" Name="Icons" />
    </Directory>
  </Directory>
</Directory>

And let the user optionally change the INSTALLFOLDER as you do now.