Ultimately what kind of paths do you want for your product's installation? What do you wish as far as customizability of your customers regarding those paths?
If you simply want to ensure that the default installation drive is %SystemDrive% AND you are not using one of the predefined paths (such as Program Files or a per-user profile path of some sort) then this is the solution. Eliminate from that solution any sequence tables you active suppress. The reason for scheduling a "custom action" (abet one that simply sets a property based on a formatted value) is that setting this property via the Property table (aka using the Property element) does not allow use of the formatted syntax (your ROOTDRIVE value would be the literal text "%SystemDrive%" which, guaranteed, will NOT be found and you will get errors). SourceDir is set to the directory your MSI is run from. It generally doesn't make sense to change it unless you know where you have archived the installation cabs/non-compressed source files. TARGETDIR might be a good candidate, but if you change it this way you may not be able to set it via the command line. If TARGETDIR's set via the command-line, ROOTDRIVE will most likely be ignored. BTW, I have thought of an improvement to my code below: Change the first line (the CustomAction element) to: <CustomAction Id='SetRootDrive' Property='ROOTDRIVE' Value='[%SystemDrive]\' Execute='firstSequence'/> And add the following line: <Property Id='ROOTDRIVE' Secure='yes'/> Keep the rest of the code as supplied. -----Original Message----- From: Cherney John-CJC030 [mailto:john.cher...@motorola.com] Sent: Tuesday, October 13, 2009 5:59 PM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] TargetDir/SourceDir question Is ROOTDRIVE the right thing to modify? Should I modify SourceDir or TARGETDIR instead? I have to do a custom action for this? I can't get away with setting a particular property and having it use that? I'm not complaining. I'll do this. I'm learning that I know less than what little I thought I knew. :) Thanks! jwc -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Tuesday, October 13, 2009 7:15 PM To: 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] TargetDir/SourceDir question ROOTDRIVE in non-administrative installations is always set (if you don't set it yourself) to the local drive with the largest amount of free space. See http://msdn.microsoft.com/library/aa371372.aspx Add this to your setup authoring: <CustomAction Id='SetRootDrive' Property='ROOTDRIVE' Value='[%SystemDrive]\'/> <AdvtExecuteSequence> <Custom Action='SetRootDrive' Before='CostInitialize'/> </AdvtExecuteSequence> <InstallUISequence> <Custom Action='SetRootDrive' Before='CostInitialize'/> </InstallUISequence> <InstallExecuteSequence> <Custom Action='SetRootDrive' Before='CostInitialize'/> </InstallExecuteSequence> <!-- only include these remaining two sequence tables if you wish to override the "first network drive" behavior --> <AdminUISequence> <Custom Action='SetRootDrive' Before='CostInitialize'/> </AdminUISequence> <AdminExecuteSequence> <Custom Action='SetRootDrive' Before='CostInitialize'/> </AdminExecuteSequence> That will set ROOTDRIVE to the volume indicated by the environment variable %SystemDrive%. BTW, the "\" character after the "[%SystemDrive]" is significant. -----Original Message----- From: Cherney John-CJC030 [mailto:john.cher...@motorola.com] Sent: Tuesday, October 13, 2009 1:58 PM To: wix-users@lists.sourceforge.net Subject: [WiX-users] TargetDir/SourceDir question I apologize if this question is answered in an FAQ or email somewhere. I didn't turn up much when I was searching this mailing list. I'm running into a problem with TARGETDIR or SourceDir. I always want my install to go onto C: (or the SystemDrive environment variable), but my installs are going onto E:. From reading the WiX and Windows Installer manual, it sounds like TARGETDIR has to be set to Name="SourceDir", and becomes the value of RootDrive if TARGETDIR isn't set on the command line. RootDrive is determined by the first writable drive that is discovered by the installer. I am able to install on either drive if as long as I specify TARGETDIR on the command line. If I don't want the user to have to specify anything on the command line, what do I have to put in the Product.wxs file so that it always installs on the %SystemDrive% drive? Thank you! jwc ------------------------------------------------------------------------ ---- -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------ ------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users