Lots of pages in the internet and books about Windows Installer are citing the following Microsoft page ROOTDRIVE for:
If ROOTDRIVE is not set at a command line or authored into the Property table, the installer sets this property. During an administrative installation the installer sets ROOTDRIVE to the first connected network drive it finds that can be written to. If it is not an administrative installation, or if the installer can find no network drives, the installer sets ROOTDRIVE to the local drive that can be written to having the most free space.
Well, on my customer's machine C:
has lots of more free space than Y:
, but the application gets installed into Y:MyApp
instead of C:Program Files (x86)MyApp
. Of course the WiX and Directory structure are standard-style:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.CompanyName)">
<Directory Id="MyAppFolder" Name="MyApp" />
</Directory>
</Directory>
</Directory>
So nothing special. On other machines it installs to Program Files
folder as expected.
From my daily experience the rule with the "most free space" cannot be true, since on lots of machines I am dealing with have a rather small SSD as C:
local drive and a much, much more bigger data drive D:
with Terabytes more free space than C:
. If that rule would fit then nowadays most of the computers would have (all) their applications being installed to their Data Drive root directory (e.g. D:
) and not underneath the specially-protected %ProgramFiles%
/%ProgramFiles (x86)%
folders. On all my machines with the configuration small SSD vs. big data HDD with more space all the stuff gets installed into my expected Program Files
folders in C:
. So the rule of the "most free space" is definitely NOT TRUE!!! And the MSIs are not especially defining any TARGETDIR
or ROOTDIR
property to C:
on command line neither MSI table in any case!
So there must be another evalution rule. Which one is it? Who can explain the odd behaviour?
EDIT
Thanks to Stein I did a closer look at the logs and found out that ROOTDRIVE
actually really points to the larger local disks but due to the higher priority of the System Folder Properties it always gets installed into the right place on System Drive. The log file I also looked into when asking the question was the one from Dell Data Protection which explicitly must have set ROOTDRIVE
to C:
or System Drive. Thus The ROOTDRIVE
rule from MSDN seems to be true but it does not have any effect in most of the times.
When I looked on the problem computer myself I saw that Y: was a network drive, then I searched for the word ADMIN et voilà: it was an administrative installation although my customer told me that he just double-clicked on the MSI and Y: was a local drive => my airing grievance this year for the festivus will be that one should not never believe what the customer says and vows ;-)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…