We let the user modify the target directory in our UI, but I find I need
to use a type 35 Custom Action (no external code involved, though) to
alter the property being used. Also, on an upgrade we present the user
with the same directory they chose the first time around, but they can
alter it to do the major install someplace else if they want to. (i.e.
their C: drive where they first put it is getting full, so they want to
"upgrade" to E:)

<Property Id="HARLANDFSFOLDER">
<RegistrySearch Id="HFSRootSearch" Root="HKLM"
Key="Software\HarlandFS\E3" Name="InstallDirectory" Type="directory"/>
</Property>

<CustomAction Id="SetHarlandFSFolder" Directory="HARLANDFSROOT"
Value="[HARLANDFSFOLDER]"/>
 And then in the InstallUISequence

<Custom Action="SetHarlandFSFolder"
After="CostFinalize"><![CDATA[HARLANDFSFOLDER <> "" ]]></Custom>


-----Original Message-----
From: Nicholas Makin [mailto:nma...@opentext.com] 
Sent: Thursday, September 03, 2009 10:12 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Allowing the user to override the install directory

Please excuse my frustration but I am finding WiX to be neigh worthless
- why? Because there is a plethora of information by half of it is no
good and the other half points you to the mysterious MSI documentation
which is wonderful if one could figure out how that translates to WiX.

All I want to do is have a default directory structure:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="INSTALLDIR" Name="Acme">
            <Component Id="AppSettings" Guid="
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ">

But let the user choose to install in another place:

          <Property Id="WIXUI_INSTALLDIR" Value=" INSTALLDIR " />
          <Publish Dialog="InstallDirDlg" Control="Next"
Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
          <Publish Dialog="InstallDirDlg" Control="Next"
Event="NewDialog" Value="VerifyReadyDlg" Order="2">1</Publish>
          <Publish Dialog="InstallDirDlg" Control="ChangeFolder"
Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]"
Order="1">1</Publish>
          <Publish Dialog="InstallDirDlg" Control="ChangeFolder"
Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

However when I use the above - no matter what the user chooses the
component is always placed at: C:\Program Files\Acme - i.e. the dialog
is pointless.

So I made this change:

<Property Id="INSTALLDIR" Value="Acme" />
<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder" Name="PFiles">
        <Directory Id="INSTALLDIR" Name=".">
            <Directory Id="FILELOC" Name="OTInstaller">
                <Component Id="AppSettings" Guid="
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ">

Well this tries to install to come network drive named Acme.

I did find that I can insert "C:\Program Files\Acme" but this results in
a warning about hard coding directories This is what I guess I will have
to live with. I did try something like [ProgramFilesFolder]\Acme - but
this too resulted in an error - I guess a property can't be used to set
another property in this way.

Ultimately I know that my frustrations are a result of just not
understanding how MSI works with directories but all I have are 100's of
examples to extrapolate from and none of them seem to offer correct
advice (i.e. it either does not work (WiX Wiki example) or results in
errors). As I fight my way though building this installer I find that
this has consistently been the case - 100's of examples but no real
information to help you extrapolate to achieve what you need which is
often just a tiny tweak on the example. Without some sort of
understanding there is no way to get form the example to the desired
functionality - and how can you build understanding from examples that
don't work?

So aside from helping me get these files placed where the user wants
them - if someone ever figure out the secret to WiX - write a good solid
book on it and I will buy it and I know other users will love to have
it. WiX is wonderful - but so much time gets wasted trying to work out
details. I am ever to tempted to use VBScript to do custom actions to do
things that WiX clearly can do - just because I cannot figure out HOW to
do it. This is madness

(I have found many books with WiX examples - generally a 2-3 page
section with an example that is usually copied from the tutorial (or
darn near) or the Wiki.)

Nicholas

(again sorry for the frustration in my tone)
------------------------------------------------------------------------
------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day 
trial. Simplify your report design, integration and deployment - and
focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to