Thanks Blair, you're right, since I can't communicate with the package
author, I only have a choice to create a custom action that can modify
INSTALLDIR.

And I have the following:
----------------------------------------------------------------------------------------------------------------------------------------------------------
+++  My directory structure:

     <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="MYDIR" Name="My Directory"/>
      </Directory>

+++  My custom action:

  <CustomAction Id="SetMyMergeModulePath" Script="vbscript">
        <![CDATA[
          ' code to modify Session.Property("INSTALLDIR") to its parent
        ]]>
   </CustomAction>

+++
   <InstallExecuteSequence>
        <Custom Action="SetMyMergeModulePath" Before="CostInitialize" >NOT
Installed</Custom>
   </InstallExecuteSequence>

----------------------------------------------------------------------------------------------------------------------------------------------------------

And it works with INSTALLDIR suplied from the command line installation
[msiexec ......INSTALLDIR ="...." ], which is good.

However it doesn't work if I enter INSTALLDIR from the UI.

The log show that MYDIR value is set right after INSTALLDIR is entered the
the UI dialog, even after that my custom action does actually modify
INSTALLDIR, its change does not help any more because MYDIR is already set
with the old INSTALLDIR.


I tried to modify MYDIR using another custom action, but modifying using
VBScripts through Session.Property("MYDIR") actually adds another MYDIR
property not the MYDIR of my merge module. Using custom action 35 to set
MYDIR after changing the INSTALLDIR like:

 <CustomAction Id="SetMyDirPath"
              Directory="MYDIR"
              Value="[INSTALLDIR]\something " />

then it doesn't get [INSTALLDIR] (passed in empty)


I am so confused :)

Regards,

On Mon, Oct 26, 2009 at 7:56 PM, Blair <os...@live.com> wrote:

> Normally the INSTALLDIR passed to a mergemodule is where the package author
> wants the merge module's content to be. Your requirement seems to indicate
> that you are not allowed to communicate to the package author what
> directory
> they are supposed to supply to you when performing the merge.
>
> If you truly cannot "fix" this via documentation then you will need some
> sort of custom action that can take a property who's value represents a
> path
> and return the parent directory (ending in a back-slash), which you will
> declare as the parent of the directory where you really will install your
> content.
>
> -----Original Message-----
> From: Hoang Le [mailto:hoangle2...@gmail.com]
> Sent: Friday, October 23, 2009 12:11 PM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Modify INSTALLDIR using custom action?
>
> Thanks Alex, I learnt from your blog that CA Type 35 scheduled after
> CostFinalize can be used to set MYDIR.
>
> However, the issue is that [INSTALLDIR] passed in by the parent project
> could be anywhere (user input), so I don't know it in advance. So it comes
> back to the question how I can walk up to the parent directory and create
> my
> directory structure from there.
>
> Here what I have:
>
> --------------------------------------------Place holder for MYDIR
> -------------------------------------------------------------------
> <Directory Id="TARGETDIR" Name="SourceDir">
>         <Directory Id="INSTALLDIR"  />
>         <Directory Id="MYDIR" Name="." />
> </Directory>
>
> and the CA is:
>
> ----------------------------------------------Custom Action
> -----------------------------------------------------------------
> <CustomAction Id="SetMyDirPath"
>                    Directory="MYDIR"
>                    Value="[INSTALLDIR]\..\My folder" />
>
>  <InstallExecuteSequence>
>        <Custom Action="SetMyDirPath" After="CostFinalize">Not
> Installed</Custom>
> </InstallExecuteSequence>
>
> ----------------------------------------------------------------------------
> -----------------------------------
>
> The compiler would complain about the ".." again, something like: Error
> 1324. The folder path '..' contains an invalid character.
>
>
>
> On Thu, Oct 22, 2009 at 3:57 PM, Alexander Shevchuk (Volt) <
> a-ale...@microsoft.com> wrote:
>
> > You need to use CA Type 35 scheduled after CostFinalize to set MYDIR to
> > whatever you want.
> >
> > Alex
> >
> >
> >
> > -----Original Message-----
> > From: Hoang Le [mailto:hoangle2...@gmail.com]
> > Sent: Thursday, October 22, 2009 3:44 PM
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Modify INSTALLDIR using custom action?
> >
> > Thanks Craig, I've tried this before and the compiler doesn't seem to
> like
> > the ".."
> >
> > My code somehow like this
> >
> > <Directory Id="TARGETDIR" Name="SourceDir">
> >          <Directory Id ="INSTALLDIR">
> >              <Directory Id="MYDIR" Name="[INSTALLDIR]..\MyInstallDir" />
> >          </Directory>
> > </Directory>
> >
> > Here is the error:
> >
> > ----------- error CNDL0027: The Directory/@Name attribute's value,
> > '[INSTALLDIR]..\MyInstallDir', is not a valid long name because it
> contains
> > illegal characters.  Legal long names contain no more than 260 characters
> > and must contain at least one non-period
> > character.  Any character except for the follow may be used: \ ? | > < :
> /
> > *
> > ". ----------------------------
> >
> >
> > On Thu, Oct 22, 2009 at 3:08 PM, Craig Miller <
> > craig.mil...@spatialminds.com
> > > wrote:
> >
> > > Try "[INSTALLDIR]..\siblingdir\"
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Hoang Le [mailto:hoangle2...@gmail.com]
> > > > Sent: Thursday, October 22, 2009 3:02 PM
> > > > To: General discussion for Windows Installer XML toolset.
> > > > Subject: [WiX-users] Modify INSTALLDIR using custom action?
> > > >
> > > > Hi,
> > > >
> > > > My merge module receives an INSTALLDIR value passed in by a parent
> > > project
> > > > (which I have no control over), and the requirement is that I have to
> > > > install my files to a directory under "the parent" of  INSTALLDIR (a
> > > sibling
> > > > of INSTALLDIR).
> > > >
> > > > My initial thought was to get the value of [INSTALLDIR], locate its
> > > parent,
> > > > then create my dir structure from there. This sounds very simple but
> > > quite
> > > > hard to achieve.
> > > >
> > > > Any helpful idea is greatly appreciated.
> > > >
> > > > Thanks.
> > > >
> > >
> > >
> >
>
> ----------------------------------------------------------------------------
> > > --
> > > > 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
> >
>
> ----------------------------------------------------------------------------
> --
> 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

Reply via email to