0

I've tried:

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

but ROOT_FOLDER sometimes pointing to C: drive, sometimes to other drives, on different machines. How can I fix and tell it should be C drive root?

Pablo
  • 28,133
  • 34
  • 125
  • 215
  • The C:\ drive may not be present on some systems since it is not required to have a C:\ drive in Windows. Something to keep in mind. – Brian Sutherland Jul 04 '16 at 16:11

1 Answers1

-1

There's a built-in Windows Installer property for this, it's called ROOTDRIVE. As you can see from its description:

...the installer sets ROOTDRIVE to the local drive that can be written to having the most free space.

If you always need it to be C, you can add a record to the Property table for this. In WiX, this is done like this:

<property id="ROOTDRIVE" value="C:\" />
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • The **`ROOTDRIVE`** concept can be very strange to deal with, but I wouldn't hard code its reference to **``C:\``** unless the package is for a standard operating environment (SOE) where a **``C:\``** drive is guaranteed to exist (and even then I don't like it). [Here is another answer with some intel on the subject](https://stackoverflow.com/a/52561165/129130). See section on **`TARGETDIR`**. – Stein Åsmul Feb 13 '19 at 14:11