The only way I have found to set a directory to a fixed folder is to use
a custom action:

    <InstallExecuteSequence>
      <Custom Action="DIRCA_INSTALLDIR"
Before="CostInitialize"><![CDATA[INSTALLDIR=""]]></Custom>
    </InstallExecuteSequence>

    <InstallUISequence>
      <Custom Action="DIRCA_INSTALLDIR"
Before="CostInitialize"><![CDATA[INSTALLDIR=""]]></Custom>
    </InstallUISequence>

    <CustomAction Id="DIRCA_INSTALLDIR" Return="check"
Property="INSTALLDIR" Execute="firstSequence" Value="C:\" />

(You can ignore the condition 'INSTALLDIR=""' if you want but it allows
you to specify the value of INSTALLDIR on the command line if you need
to.)

In WiX v3 you can probably do this with <SetProperty>. 

Background: From what I understand having TARGETDIR as the first level
directory is just convention and it is set to the same value as ROOTDIR.
ROOTDIR is set by Windows Installer to the drive with the most free disk
space, not the system root as you might expect.

I hope this helps.

Neil

-----Original Message-----
From: Colin Fox [mailto:greenene...@gmail.com] 
Sent: 23 December 2008 00:49
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] A Couple of fundamental questions

On Mon, Dec 22, 2008 at 4:09 PM, Bob Arnson <b...@joyofsetup.com> wrote:

> Colin Fox wrote:
> > I can grab the SharePoint location out of the registry, but for the
life
> of
> > me I just can't seem to get that set as the TARGETDIR. TARGETDIR
always
> just
> > gets reset to D:\.
> >
>
> MSI sets TARGETDIR so I'd suggest using a Directory element underneath
> the one for TARGETDIR. Just give it an Id with the same name as the
> RegistrySearch property. That's what the WiX setup does.
>

Hmm. I've tried that, but no joy.

Here is the relevant chunk from my file:

    <Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />

    <Property Id="INSTALLDIR">
        <RegistrySearch Id='SharepointRegistry' Type='raw'
        Root='HKLM'
Key='SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\'
        Name='SharePoint' />
    </Property>

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="INSTALLDIR">
        <Directory Id="INSTALLLOCATION" Name="ml">

            <Component Id="ProductComponent"
            Guid="89C02981-D751-411f-9616-A202547F9D5F">

            <File Id="MLSP_asmx"...>


I actually need the files installed in a directory called "ml" in the
sharepoint dir, which is why I have it set in INSTALLLOCATION. That part
works - my files are installed under an ml directory.

But if I search for INSTALLDIR in the log, here's all I see:

...
MSI (s) (D0:B4) [16:43:37:273]: PROPERTY CHANGE: Adding INSTALLDIR
property.
Its value is 'D:\'.
...

MSI (s) (D0:B4) [16:43:37:273]: Dir (target): Key: INSTALLDIR    ,
Object:
D:\
....
Action ended 16:43:37: InstallFinalize. Return value 1.
Action ended 16:43:37: INSTALL. Return value 1.
Property(S): INSTALLDIR = D:\
Property(S): INSTALLLOCATION = D:\ml\
Property(S): TARGETDIR = D:\
....


There is an example referenced in the tutorial that does just about the
same
thing, though he's going based on the location of the .ini file. But he
sets
the INSTALLDIR property the same way (just before the 3 nested
directories),
and uses it the same way.

So what am I doing wrong?
-- 
Regards,
 cf
------------------------------------------------------------------------
------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to