With this structure you can specify the location of the Services directory 
using SERVICESDIR. Doing so will change both Cmds and Logs to be rooted under 
SERVICESDIR. You can't change the location of Logs by specifying INSTALLDIR 
because INSTALLDIR applies only to Cmds.

Msiexec /I file.msi INSTALLDIR=C:\Custom\Directory\Services\Cmds

The command line above only changes the location of INSTALLDIR. If you want to 
change the location of Logs then you also need to specify CANSERVICESLOGFILEDIR:

Msiexec /I file.msi INSTALLDIR=C:\Custom\Directory\Services\Cmds 
CANSERVICESLOGFILEDIR=C:\Custom\Directory\Services\Logs

Alternatively you can specify SERVICESDIR if the default directory names of 
Cmds and Logs are acceptable:

Msiexec /I file.msi SERVICESDIR=C:\Custom\Directory\Services

If you want the user to specify INSTALLDIR and then use the parent directory to 
also contain Logs, then you'll need to write a custom action to parse 
INSTALLDIR and set CANSERVICESLOGFILEDIR appropriately.

In my opinion, that's too many ways to do it. I would allow the user to specify 
the location of the Services directory (and call that INSTALLDIR) and create 
the subdirectories with hardcoded names:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="INSTALLDIR" Name="Services">
        <Directory Id="CmdsDir" Name="Cmds">
        ...
        </Directory>
        <Directory Id="LogsDir" Name="Logs">
        ...
        </Directory>
    </Directory>
</Directory>

This way the installer always creates folders called Cmds and Logs under a 
directory that can be specified by the user as INSTALLDIR:

Msiexec /I file.msi INSTALLDIR=C:\Custom\Directory\Services

Edwin G. Castro
Software Developer - Staff
Electronic Banking Services
Fiserv
Office: 503-746-0643
Fax: 503-617-0291
www.fiserv.com
Please consider the environment before printing this e-mail


> -----Original Message-----
> From: Bajpai, Ramit [mailto:ramit.baj...@monster.com]
> Sent: Wednesday, March 31, 2010 11:12 AM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] [Wix-users] Question regarding TARGETDIR &
> INSTALLDIR
> 
> Sorry, for the typo here is correct structure...
> 
> <Directory Id="TARGETDIR" Name="SourceDir">
> 
>       <Directory Id="SERVICESDIR" Name="Services">
> 
>             <Directory Id="INSTALLDIR" Name="Cmds">
> 
>             . . .
> 
>             </Directory>
> 
>       <Directory Id="CANSERVICESLOGFILEDIR" Name="Logs">
> 
>               <Component Id="xxx" Guid="xxxxxxxx-xxxx-xxxx-xxxx-
> xxxxxxxxxxxx">
> 
>                         <CreateFolder />
> 
>               </Component>
> 
>       </Directory>
> 
>       </Directory>
> 
> 
> 
> 
> </Directory>
> 
> -----Original Message-----
> From: Bajpai, Ramit [mailto:ramit.baj...@monster.com]
> Sent: Wednesday, March 31, 2010 12:06 PM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] [Wix-users] Question regarding TARGETDIR &
> INSTALLDIR
> 
> We have the following directory structure wherein we want the Logs
> folder to be created at the same level as the Services folder.
> 
> 
> 
> <Directory Id="TARGETDIR" Name="SourceDir">
> 
>       <Directory Id="SERVICESDIR" Name="Services">
> 
>             <Directory Id="INSTALLDIR" Name="Cmds">
> 
>             . . .
> 
>             </Directory>
> 
>       </Directory>
> 
>       <Directory Id="CANSERVICESLOGFILEDIR" Name="Logs">
> 
>             <Component Id="xxx" Guid="xxxxxxxx-xxxx-xxxx-xxxx-
> xxxxxxxxxxxx">
> 
>                   <CreateFolder />
> 
>             </Component>
> 
>       </Directory>
> 
> </Directory>
> 
> Now what happens is, if the user runs the installer in Custom mode and
> chooses a different drive from what the installer picked up based on
> the information here:
> 
> http://msdn.microsoft.com/en-us/library/aa372064.aspx
> 
> http://msdn.microsoft.com/en-us/library/aa371372.aspx
> 
> The installer installs the application at the new location but still
> creates the Logs folder at the original location picked by the
> installer.
> 
> Lets take an example:
> 
> The installer picks INSTALLDIR as D:\Services\Cmds
> 
> The user changes it to C:\Services\Cmds
> 
> So, instead of creating the logs folder like this C:\Services\Logs, the
> installer still creates it at D:\Services\Logs
> 
> I know when the user picks a different location for installation it
> just changes the INSTALLDIR property to the new value but the TARGETDIR
> still points to the original destination. Shouldn’t picking the new
> INSTALLDIR should by default change the TARGETDIR? Atleast, it looks
> like a valid usecase to me, is this some kind of bug or is it designed
> to behave like this only?
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Ramit
> 
> Ramit Bajpai |CAN <http://can.monster.com/>  | Monster Worldwide
> <http://www.monster.com/>  | Direct: 978.823.2570 | Cell: 508.395.7037
> 
> 
> 
> 
> 
> NOTICE:
> 
> 
> 
> This message, and any attachments, contain(s) information that may be
> confidential or protected by privilege from disclosure and is intended
> only for the individual or entity named above. No one else may
> disclose, copy, distribute or use the contents of this message for any
> purpose. Its unauthorized use, dissemination or duplication is strictly
> prohibited and may be unlawful. If you receive this message in error or
> you otherwise are not an authorized recipient, please immediately
> delete the message and any attachments and notify the sender.
> 
> -----------------------------------------------------------------------
> -------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> -----------------------------------------------------------------------
> -------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to