6

The default directory in WixUI_InstallDir is always D:. How do i change it to directory C:?

It is also not showing my directory structure defined in .wxs file.It is only showing D:.It should actually show 'D:\folder1\folder2'. why is that ? what will i have to do to show the directory structure?

   <Property Id="ROOTDRIVE"><![CDATA[C:\]]></Property>
        <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="ProgramFilesFolder">
            <Directory Id='E' Name='E'>
               <Directory Id="dirm" Name="E Mrch">
                   <Component></Component>
               </Directory>
            </Directory>
          </Directory>
        </Directory>
subs
  • 2,189
  • 12
  • 35
  • 59
  • Can you post the relevant xml, so we can help out? – fletcher Jul 21 '10 at 08:04
  • i have added the XML.I am able to change the default drive to C: by using rootdrive property. But it is still not showing the directory structure i.e 'C:\programfiles\EFI\EFI Monarch'. it is only showing the C drive i.e. 'C:'. How do i do that? And what will happen if the system does not have a 'C' drive at all? – subs Jul 21 '10 at 17:32
  • One thing I just learned (painfully) is that if you use ProgramFilesFolder, then ROOTDRIVE becomes irrelevant, because Program Files inherently has a drive which overrides any ROOTDRIVE setting when the paths combine. – Mark Bailey Sep 20 '13 at 15:05

2 Answers2

16

You can use the following property in the Product definition:

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>

INSTALLDIR can be defined like

<Directory Id="ProgramFilesFolder">
    <Directory Id="MySoftware" Name="MySoftware">
      <Directory Id="INSTALLDIR" Name="MyProduct">
      </Directory>
    </Directory>
</Directory>
sharptooth
  • 167,383
  • 100
  • 513
  • 979
liggett78
  • 11,260
  • 2
  • 29
  • 29
5

By default, TARGETDIR (and ROOTDRIVE but nobody uses that) default to the largest drive on the machine. See ligget78's answer to address that.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130