2
votes

I'm using WIX 3.5 for my setup project. If I change the installation directory during installation, the installer insists on using the default directory.

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="LocalAppDataFolder" Name="AppData">
    <Directory Id="InstallationDir" Name="MyApp" />
  </Directory>
</Directory>
...
<DirectoryRef Id="InstallationDir">
   ... component + files ...
</DirectoryRef>
...
<UI>
   <Property Id="WIXUI_INSTALLDIR" Value="InstallationDir" />
   <UIRef Id="WixUI_InstallDir" />
   <UIRef Id="WixUI_ErrorProgressText" />
</UI>

<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="InstallationDir" />
<InstallExecuteSequence>
   <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate" />
</InstallExecuteSequence>

I tried both upgrading (I'm always changing the product code) and uninstall/install. Same problem! If I run msiexec /L*v log.txt /i Setup.msi the log tells me that the InstallationDir property was indeed changed.

Q: How is it possible that my software is installed into the default directory?

2

2 Answers

2
votes

You must use an all-uppercase name for a directory to be customizable. Uppercase is how MSI declares a directory (and property) to be PUBLIC and therefore customizable.

0
votes

Thanks for the solution. I could not figure out why my installer was not copying files to the correct user specified directory until I found this post.

I just want to emphasize that that if your installer copies files to sub directories under INSTALLDIR then their Ids must not be all uppercase or they will not be changed when INSTALDIR is changed by the user via the custom installation dialog. You can verify that by using

msiexec /i your_installer.msi /l*v log.log

and you can see that any directory with all all uppercase Ids will be set only once.