Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix - Setting Install Folder correctly

Tags:

I'm creating a program which is being installed by Wix, using VS 2010 and I've already got the product.wxs ready.

In my wxs file, I've got directory definitions which looks like this:

<SetDirectory Id="INSTALLFOLDER" Value="[WindowsVolume]Myapp" /> <Directory Id="TARGETDIR" Name="SourceDir">   <Directory Id="INSTALLFOLDER" Name="Myapp">     <Directory Id="Myapp_Installer_Dir" Name="Myapp">           <Directory Id="BIN" Name="Bin" />           <Directory Id="ICONS" Name="Icons" />     </Directory>   </Directory> </Directory> 

And then I got these file installation definitions:

<DirectoryRef Id="Myapp_Installer_Dir">   <Component Id="INSTALLER_Myapp" Guid="{94F18477-8562-4004-BC6F-5629CC19E4CB}" >     <File Source="$(var.Myapp.TargetPath)" KeyPath="yes"/>   </Component> </DirectoryRef>  <DirectoryRef Id="BIN">   <Component Id="INSTALLER_Data" Guid="{545FB5DD-8A52-44D7-898E-7316E70A93F5}" >     <File Source="$(var.Data.TargetPath)" KeyPath="yes"/>   </Component>     ... 

And it continues in that manner. The files for the "ICONS" directory are defined as well.

I am also using the WixUI_InstallDir dialog set and I got these lines present as well:

<Property Id="WIXUI_INSTALLDIR" Value="Myapp_Installer_Dir" /> <UIRef Id="WixUI_InstallDir" /> 

The problem is when the user installs the program and changes the value of the installation folder, the files of the "Bin" and "Icons" are installed to their correct path, but the Myapp target is installed to a fix location which was defined at the start as the default installation path.

Why do only the bin and icon files installed to the correct folder the user wanted, but the myapp target does not?

like image 639
Yonatan Nir Avatar asked Oct 14 '13 07:10

Yonatan Nir


People also ask

What is Targetdir WiX?

As I discovered at this link, TARGETDIR is actually supposed to represent the root of the drive with the most free space available (assuming there's more than one). That's why WiX projects have directories nested under there for Program Files, etc.


1 Answers

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.

like image 100
Yonatan Nir Avatar answered Oct 05 '22 23:10

Yonatan Nir