Thanks, Pally.  I actually found Bob's article right after I sent out this
message yesterday.  It's very enlightening.

To tie everything together once again, what I had below for the code block
was really a test trying to figure out when &BaseFeature had a reasonable
value.

The real issue at this point (just to further complicate things, and going
back to my original post) is that there are 2 files, one per feature, and
that the CMP_BaseCopyConfig should only run if the first feature is being
installed and NOT the second.  The second file should only be installed if
the second feature is being installed (I can handle that one as you
suggest.)

What I found out, through Bob's article and another blog article from Rob
Mensching about how "VBScript and JScript Custom Actions suck" is that:

a) I need to do the test for copying post-CostFinalize, necessitating a
custom action
b) doing the copy with VBScript or JScript will (and did, in my case) run
afoul of virus checkers, throwing up an error and failing
c) it appears the only way to do this (unless I missed something elsewhere)
is via compiled code that I have to write.

Does anybody else see any other way to get this done--copy a file from
BaseFeature if ExtrasFeature is not being installed, and copy a file from
ExtrasFeature if it IS being installed?  (Obviously the second one can just
be done by including a second reference to the extras-config.xml to install
the copy--no custom action needed, per Pally's suggestion below.)

It does seem pretty unfortunate that a simple thing like copying 1 file
based on whether or not some feature is being installed is so involved, and
requires writing C++ or other compiled code to do it.

Thanks,
Dave

On Tue, Jun 14, 2011 at 3:21 AM, Pally Sandher <pally.sand...@iesve.com>wrote:

> The Component Table MSDN page
> (http://msdn.microsoft.com/en-us/library/aa368007.aspx) has this to say
> about the Condition field:
> "The Condition field enables or disables a component only during the
> CostFinalize action. To enable or disable a component after
> CostFinalize, you must use a custom action or the DoAction ControlEvent
> to call MsiSetComponentState."
> Which is what I think you're running into.
>
> Bob Arnson wrote a blog article explaining the confusion here a while
> back ->
> http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditi
> ons/
>
> The simple solution is to add a ComponentRef for CMP_BaseCopyConfig to
> BaseFeature. You're trying to make that Component install only when the
> Feature is installed so the logical solution would be to make it part of
> it & skip Conditioning it all together since it's unnecessary.
>
> Palbinder Sandher
> Software Deployment Engineer
> T: +44 (0) 141 945 8500
> F: +44 (0) 141 945 8501
>
> http://www.iesve.com
> **Design, Simulate + Innovate with the <Virtual Environment>**
> Integrated Environmental Solutions Limited. Registered in Scotland No.
> SC151456
> Registered Office - Helix Building, West Of Scotland Science Park,
> Glasgow G20 0SP
> Email Disclaimer
>
> -----Original Message-----
> From: Dave Combs [mailto:dave.co...@kaazing.com]
> Sent: 13 June 2011 23:29
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] looking for some help on a file-copying task
> duringinstall
>
> I figured out the 'insufficient privileges' problem (it was because I
> had
> another window open on the directory at the time, so everything just
> failed,
> but with the odd message.)  That ran me into another problem.  With the
> stuff below I can write a condition
>
> <Condition>
>  <![CDATA[&BaseFeature=3]]>
> </Condition>
>
> to conditionally do the copying of the file base-config.xml to
> config.xml.
> However, this test always fails, even when I choose to install the base
> feature.  However, if I choose to install the base feature but change
> the
> condition to NOT (&BaseFeature=3), the copying occurs.  Of course, it's
> not
> what I want.  Can anybody suggest why the reference to &BaseFeature
> above
> doesn't seem to return a usable value?
>
> Here's the complete code block:
>
>    <DirectoryRef Id="TARGETDIR">
>      <Component Id="CMP_BaseCopyConfig"
> Guid="2E5C60C4-956A-11E0-BC3C-BCD94824019B" KeyPath="yes">
>        <Condition>
>          <![CDATA[NOT (&BaseFeature=3)]]>
>        </Condition>
>        <CopyFile Id="Copy_Base_Config"
>              FileId="FILE_31"
>              DestinationDirectory="DIR_6" DestinationName="config.xml"
> />
>      </Component>
>    </DirectoryRef>
>
> The fileId FILE_31 points to the base-config.xml file.
>
> Dave
>
> On Mon, Jun 13, 2011 at 11:18 AM, Dave Combs <dave.co...@kaazing.com>
> wrote:
>
> > Actually, I ended up doing something I found in the list archives from
> 19
> > Oct 2006:
> >
> > I also found another way of solving this issue.  put the component
> > (that contained the <CopyFile>) into a <DirectoryRef Id="TARGETDIR">
> > element. This is possible because I specify both source (by FileId)
> > and destination (by DestinationProperty) explicitely in the <CopyFile>
> > element. I consider this way of doing it to be cleaner, since I avoid
> > an artificial <CreateFolder> element.
> >
> > Thanks for all the replies anyway.
> >
> > Jarl
> >
> > --
> > Jarl Friis
> >
> >
> > However, I now run into a different problem that I'm once again
> looking for
> > clarification or suggestions:
> >
> > The install proceeds correctly until near the end (when it's supposed
> to do
> > the CopyFile stuff) and I now get an error saying:
> >
> >   The installer has insufficient privileges to access this directory:
> > C:\Program Files (x86)\Kaazing\JMS\3.2\Gateway\conf.  The installation
> > cannot continue.  Log on as administrator or contact your system
> > administrator.
> >
> > My confusion is because a) I have administrator privileges on the
> system,
> > and b) the installer has already copied several files into the conf
> > directory--all I'm doing is adding another one.  Any idea why I would
> get
> > this error, given that?
> >
> > Thanks,
> > Dave
> >
> >
> > On Mon, Jun 13, 2011 at 10:35 AM, Daniel Madill
> <dan.mad...@quanser.com>wrote:
> >
> >> I would assume you just need to add a CreateFolder element to ensure
> the
> >> destination directory is created. For example:
> >>
> >>        <CreateFolder Directory="DIR_36"/>
> >>
> >> Dan
> >>
> >> -----Original Message-----
> >> From: Dave Combs [mailto:dave.co...@kaazing.com]
> >> Sent: Monday, June 13, 2011 1:10 PM
> >> To: General discussion for Windows Installer XML toolset.
> >> Subject: Re: [WiX-users] looking for some help on a file-copying task
> >> during install
> >>
> >> Actually, I did run into an issue with trying your solution, and was
> >> curious
> >> if you or anybody else had an idea:
> >>
> >> In the <Directory> that contains the 'base-config.xml' and
> >> 'extras-config.xml' Components I put the following:
> >>
> >>          <Component Id="CMP_BaseCopyConfig"
> >> Guid="2E5C60C4-956A-11E0-BC3C-BCD94824019B">
> >>            <Condition>NOT &amp;ExtrasFeature=3</Condition>
> >>            <CopyFile Id="Copy_Base_Config"
> >>                      SourceName="base-config.xml"
> >>                      DestinationDirectory="DIR_6"
> >> DestinationName="config.xml" />
> >>          </Component>
> >>
> >>          <Component Id="CMP_ExtrasCopyConfig"
> >> Guid="399EA6B8-956A-11E0-8EC6-CBD94824019B">
> >>            <Condition>&amp;ExtrasFeature=3 AND NOT
> >> !ExtrasFeature=3</Condition>
> >>            <CopyFile Id="Copy_Extras_Config"
> >>                      SourceName="extras-config.xml"
> >>                      DestinationDirectory="DIR_6"
> >> DestinationName="config.xml" />
> >>          </Component>
> >>
> >> In this, DIR_6 is the ID of the directory I'm copying to, DIR_36 is
> the ID
> >> of the containing <Directory> that I'm copying from.
> >>  With the above I get the following error from light:
> >>
> >> Components.wxs(617) : error LGHT0204 : ICE18: KeyPath for Component:
> >> 'CMP_BaseCopyConfig' is Directory: 'DIR_36'. The Directory/Component
> pair
> >> must be listed in the CreateFolders table.
> >> Components.wxs(624) : error LGHT0204 : ICE18: KeyPath for Component:
> >> 'CMP_ExtrasCopyConfig' is Directory: 'DIR_36'. The
> Directory/Component
> >> pair
> >> must be listed in the CreateFolders table.
> >>
> >> I haven't seen any examples of using CopyFile that specified anything
> >> about
> >> a KeyPath, so am somewhat at a loss for how to proceed here.  Any
> >> suggestions?
> >>
> >> Thanks,
> >> Dave
> >>
> >> On Mon, Jun 13, 2011 at 10:01 AM, Dave Combs <dave.co...@kaazing.com>
> >> wrote:
> >>
> >> > Thanks (both Pally and Rob.) I actually do need the originals to
> >> continue
> >> > to exist as well, so will go with your solution, Pally. (What gets
> even
> >> > weirder is that I also need to do something when somebody does an
> update
> >> to
> >> > include the 'extras' bundle after initially installing the 'base'
> >> bundle.
> >> > In that case, I've been asked to copy the copy (take config.xml and
> copy
> >> to
> >> > config.xml.bkup) and then do the copy of extras-config.xml to
> >> config.xml.
> >> > Messy, I know.
> >> >
> >> > Thanks again!
> >> > Dave
> >> >
> >> >
> >> > On Mon, Jun 13, 2011 at 4:08 AM, Pally Sandher
> <pally.sand...@iesve.com
> >> >wrote:
> >> >
> >> >> Ah I missed Rob's reply before I posted my own. I agree with Rob
> if you
> >> >> don't need the original config.xml file(s) to exist for the user
> simply
> >> >> skip the copy & use mutually exclusive Component Conditions to
> install
> >> >> either file to the desired location.
> >> >> If you do need the base-config.xml & extras-config.xml to exist as
> well
> >> >> as config.xml then see my previous post.
> >> >>
> >> >> Palbinder Sandher
> >> >> Software Deployment Engineer
> >> >> T: +44 (0) 141 945 8500
> >> >> F: +44 (0) 141 945 8501
> >> >>
> >> >> http://www.iesve.com
> >> >> **Design, Simulate + Innovate with the <Virtual Environment>**
> >> >> Integrated Environmental Solutions Limited. Registered in Scotland
> No.
> >> >> SC151456
> >> >> Registered Office - Helix Building, West Of Scotland Science Park,
> >> >> Glasgow G20 0SP
> >> >> Email Disclaimer
> >> >>
> >> >> -----Original Message-----
> >> >> From: Rob Mensching [mailto:r...@robmensching.com]
> >> >> Sent: 13 June 2011 04:17
> >> >> To: General discussion for Windows Installer XML toolset.
> >> >> Subject: Re: [WiX-users] looking for some help on a file-copying
> task
> >> >> duringinstall
> >> >>
> >> >> I'd avoid CopyFile personally and just have a couple extra
> Components
> >> >> (conditioned correctly) to install the file.
> >> >>
> >> >> On Sun, Jun 12, 2011 at 7:32 PM, Dave Combs
> <dave.co...@kaazing.com>
> >> >> wrote:
> >> >>
> >> >> > I was hoping somebody could help with my confusion on a
> <CopyFile>
> >> >> issue.
> >> >> >
> >> >> > I have a WiX configuration to install a product with 2 features,
> call
> >> >> them
> >> >> > 'base' and 'extras'. 'base' is required, and 'extras' is
> optional.
> >> >> Both
> >> >> > 'base' and 'extras' have a config file (called 'base-config.xml'
> and
> >> >> > 'extras-config.xml').  At some point during installation, one or
> the
> >> >> other
> >> >> > of the two files (depending on what features have been chosen)
> needs
> >> >> to be
> >> >> > copied into another directory, with the file name 'config.xml'.
> >> >> >
> >> >> > My problem is that I can see that <CopyFile> can be applied
> inside a
> >> >> <File>
> >> >> > component to copy that component (but then I have 2 guys trying
> to go
> >> >> to
> >> >> > the
> >> >> > same place), or inside its own <Component> (but isn't that only
> for
> >> >> files
> >> >> > that are already on the destination machine?)
> >> >> >
> >> >> > Can anybody either point out where I'm going wrong or suggest a
> >> >> solution?
> >> >> >
> >> >> > Thanks!
> >> >> > Dave
> >> >> >
> >> >> >
> >> >>
> >>
> ------------------------------------------------------------------------
> >> >> ------
> >> >> > EditLive Enterprise is the world's most technically advanced
> content
> >> >> > authoring tool. Experience the power of Track Changes, Inline
> Image
> >> >> > Editing and ensure content is compliant with Accessibility
> Checking.
> >> >> > http://p.sf.net/sfu/ephox-dev2dev
> >> >> > _______________________________________________
> >> >> > WiX-users mailing list
> >> >> > WiX-users@lists.sourceforge.net
> >> >> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >> --
> >> >> virtually, Rob Mensching - http://RobMensching.com LLC
> >> >>
> >>
> ------------------------------------------------------------------------
> >> >> ------
> >> >> EditLive Enterprise is the world's most technically advanced
> content
> >> >> authoring tool. Experience the power of Track Changes, Inline
> Image
> >> >> Editing and ensure content is compliant with Accessibility
> Checking.
> >> >> http://p.sf.net/sfu/ephox-dev2dev
> >> >> _______________________________________________
> >> >> WiX-users mailing list
> >> >> WiX-users@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >>
> ------------------------------------------------------------------------
> ------
> >> >> EditLive Enterprise is the world's most technically advanced
> content
> >> >> authoring tool. Experience the power of Track Changes, Inline
> Image
> >> >> Editing and ensure content is compliant with Accessibility
> Checking.
> >> >> http://p.sf.net/sfu/ephox-dev2dev
> >> >> _______________________________________________
> >> >> WiX-users mailing list
> >> >> WiX-users@lists.sourceforge.net
> >> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >> >>
> >> >
> >> >
> >>
> >>
> ------------------------------------------------------------------------
> ------
> >> EditLive Enterprise is the world's most technically advanced content
> >> authoring tool. Experience the power of Track Changes, Inline Image
> >> Editing and ensure content is compliant with Accessibility Checking.
> >> http://p.sf.net/sfu/ephox-dev2dev
> >> _______________________________________________
> >> WiX-users mailing list
> >> WiX-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >>
> >>
> >>
> ------------------------------------------------------------------------
> ------
> >> EditLive Enterprise is the world's most technically advanced content
> >> authoring tool. Experience the power of Track Changes, Inline Image
> >> Editing and ensure content is compliant with Accessibility Checking.
> >> http://p.sf.net/sfu/ephox-dev2dev
> >> _______________________________________________
> >> WiX-users mailing list
> >> WiX-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wix-users
> >>
> >
> >
> ------------------------------------------------------------------------
> ------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to