The default value for TARGETDIR [1] is C:\ but tools like VS.NET setup and 
deployment projects add a type 51 CA (set property from formatted text) to set 
TARGETDIR to [ProgramFilesFolder][Manufacturer]\[ProductName].  Also TARGETDIR 
can be specified on the command line to specify where you want the application 
installed.  So Windows Installer defaults TARGETDIR to C:\ (actually ROOTDRIVE 
property) if TARGETDIR was not specified by a certain point (CostFinalize) in 
the installation sequence.

The WiX convention seems to be to set INSTALLDIR to the above path and leave 
TARGETDIR at its default.

A VS.NET setup and deployment looks something like this in WiX:

<Directory Id="TARGETDIR" Name="SourceDir">
       <Component Id="ProductComponent" Guid="MYGUIDHERE">
              <File Id="MainProgram"  Name="prog.exe"  Source="prog.cab" 
DiskId="1"  />
       </Component>
</Directory>

<!-- Sets the TARGETDIR property to a path based on ProductName property-->
<CustomAction Id="SetTARGETDIR" Property="TARGETDIR" 
Value="[ProgramFilesFolder][Manufacturer]\[ProductName]" 
   Execute="firstSequence" />

<InstallUISequence>
   <!-- Set TARGETDIR if it wasn't set on the command line -->
   <Custom Action="SetTARGETDIR" Before="CostFinalize">TARGETDIR=""</Custom>
</InstallUISequence>

<InstallExecuteSequence>
   <!-- Set TARGETDIR if it wasn't set on the command line -->
   <Custom Action="SetTARGETDIR" Before="CostFinalize">TARGETDIR=""</Custom>
<InstallExecuteSequence>

Here's some references...
[1] TARGETDIR docs - http://msdn2.microsoft.com/en-us/library/aa372064.aspx
[2] SourceDir docs - http://msdn2.microsoft.com/en-us/library/aa371857.aspx


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Anthony Wieser
Sent: Sat 3/24/2007 3:01 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] What exactly is SourceDir?
 
In all of the samples you see fragments like this:

    <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="MFR" Name="Wieser Software Ltd">
      <Directory Id="INSTALLLOCATION" Name="Prog">

       <Component Id="ProductComponent" Guid="MYGUIDHERE">
              <File Id="MainProgram"  Name="prog.exe"  Source="prog.cab" 
DiskId="1"  />
       </Component>

      </Directory>
     </Directory>
   </Directory>

I don't really understand what the SourceDir is above, even though it seems 
to be required (you get a warning if it's not there).

Looking through the logs, the SourceDir always seems to be set to the path 
of the msi file that's run, if its on a network, or even a drive created by 
subst.

However, the TARGETDIR seems always to be set to C:\

Also, why are the other directories listed as a child of TARGETDIR, when 
they can in fact be located anywhere in the file system.  Is it just a 
pragmatic solution, that requires a single top level node for parsing?

Anthony Wieser
Wieser Software Ltd


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to