2

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:.

Klas Mellbourn
  • 42,571
  • 24
  • 140
  • 158
  • Does [this](http://stackoverflow.com/a/14364415/1049308) answer your question? – John Willemse May 15 '13 at 14:16
  • @JohnWillemse No, as I don't want to change the location of the entire installation. I want a normal installation below `C:\Program Files (x86)`, but then I also want to create some folders below `D:` – Klas Mellbourn May 15 '13 at 14:25
  • 1
    Does [this](http://stackoverflow.com/questions/5269990/is-it-possible-to-have-two-root-directories-in-wix/5270909#5270909) help? – Yan Sklyarenko May 15 '13 at 14:27
  • @YanSklyarenko I found that answer unclear. How exactly does one set the location of `DATA_FOLDER` to `D:`? (You cannot set the `Name` to `D:`, that is not allowed by the schema) And how does the `WindowsVolume` setting help? (It would be on `C:` by default?) – Klas Mellbourn May 15 '13 at 16:06

1 Answers1

3

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.

idclaar
  • 688
  • 2
  • 7
  • 17