Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup File or Program Install at user define path while installation

Tags:

c#

wix

I'm very new to the WiX toolset. I have to create an installer with 2 requirements:

  1. Install the program to the default path. This works well.

The actual thing that i want to know. 2. User can choose a path. may someone help how to do that setup or program install at user defined path.

This is the code i have used for default path.

<Directory Id="TARGETDIR" Name="SourceDir" />
      <Directory Id="DesktopFolder" Name="Desktop"/>
      <Directory Id="ProgramFilesFolder" />

        <Directory Id="INSTALLDIR" Name="Test" />
          <Directory Id="dirTest" Name="dirTest">

            <Directory Id="ID"  Name="Project Name" />

              <Directory Id="A_ID" Name="NAME" />
                <Directory Id="Queries" Name="Queries" />
                  <Directory Id="v1311" Name="1.3.1.1"/>

1 Answers

It's easily found in the documentation

WixUI_InstallDir Dialog Set

WixUI_InstallDir does not allow the user to choose what features to install, but it adds a dialog to let the user choose a directory where the product will be installed.

This dialog set is defined in the file WixUI_InstallDir.wxs in the WixUIExtension in the WiX source code.

Using WixUI_InstallDir

To use WixUI_InstallDir, you must set a property named WIXUI_INSTALLDIR with a value of the ID of the directory you want the user to be able to specify the location of. The directory ID must be all uppercase characters because it must be passed from the UI to the execute sequence to take effect.

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder" Name="PFiles">
    <Directory Id="TESTFILEPRODUCTDIR" Name="Test File">
      ...
    </Directory>
   </Directory>
</Directory>
...
<Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" />
<UIRef Id="WixUI_InstallDir" />
like image 53
TheGeneral Avatar answered Mar 12 '26 16:03

TheGeneral