Klas Mellbourn
Klas Mellbourn

Reputation: 44447

How to create a directory in Wix on D:

Using WiX 3.7, I have figured out how to create a folder in the root. This

  <Directory Id="ReceivedFilesDir" Name="ReceivedFiles">
    <Component Id="ReceivedFilesComponent" Guid="84A264EF-2BC5-41e3-8124-2CA10C2805DB">
      <CreateFolder Directory="ReceivedFilesDir">
        <Permission User="Administrators" GenericAll="yes" />
      </CreateFolder>
    </Component>
  </Directory>

creates a folder C:\ReceivedFiles

I want it to be at D:\ReceivedFiles instead.

How do I achieve that?

I have played around with the DiskId attribute, but it did not seem to do anything.

Also, I don't want to change the whole installation folder, the ordinary part of the installation will still be below C:\Program Files (x86). I just want to create additional folders on D:.

Upvotes: 3

Views: 3314

Answers (1)

idclaar
idclaar

Reputation: 697

Here's the solution we used for basically the same need:

<Directory Id="TARGETDIR" Name="SourceDir">

    <Directory Id="CROOT" Name="root">
        <Directory Id="MY_CROOT" Name="PLACE_HOLDER">
            <!-- Define C directory -->
        </Directory>
    </Directory>

    <Directory Id="TROOT" Name="root">
        <Directory Id="MY_TROOT" Name="PLACE_HOLDER">
            <!-- Define T directory -->
        </Directory>
    </Directory>
</Directory>

<CustomAction Id="SetCRootDirectory" Property="CROOT" Value="C:\" />
<CustomAction Id="SetTRootDirectory" Property="TROOT" Value="T:\" />

<InstallExecuteSequence>
    <Custom Action="SetCRootDirectory" Before="AppSearch" />
    <Custom Action="SetTRootDirectory" Before="AppSearch" />
</InstallExecuteSequence> 

You could add this to a UI sequence if your install takes advantage of that. You may need to set the Custom Action Before values to some other value given how all the rest of your sequences are defined. Hope this is useful.

Upvotes: 3

Related Questions