Hi,
        So you want to install file a or b depending on feature 1 and 2.
But the problem arises as you have feature 2 as a sub feature of feature
one.

So :-

<Component Id="a">
        <File Id ="abc" Name="abc.txt" Source="C:\abc.txt"/>
</Component>
<Component Id="b">
        <File Id ="xyz" Name="xyz.txt" Source="C:\xyz.txt"/>
</Component>

<Feature1>
        <ComponentRef a />
        <Feature2>
                <ComponentRef b />
        </Feature2>
</Feature1>

...will partly work but if you choose feature two you will get both
files as it is a child feature.

The simplest fix is to make Feature2 not a child.

Unfortunatly it is not a trivial task just to condition the components
on the feature state (see Bob's article here
http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditi
ons/).

Bob's article suggests calling a custom action from the UI to set the
component state directly, my guess in this case that would be to stop
component a installing if feature 2 is selected.

Dave


-----Original Message-----
From: mahesh u [mailto:maheshu.u...@gmail.com] 
Sent: 09 July 2009 16:06
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Conditionally pass the property value
toFileElement Name, Source attributes.

My WiX file is something like this:

<Component Id="a">
<File Id ="abc" Name="abc.txt" Source="C:\abc.txt"/> </Component>

<Component
<Feature1>
<ComponentRef a />
<ComponentRef b/>
<Feature2>
<ComponentRef z/>
</Feature2>
</Feature1>

So, my requirement is Component 'a' should be executed with file
"abc.txt"
if Feature1 is marked for install and it should be executed with
Name="xyz.txt" if Feature2 is marked for install.

I can know whether a feature is marked for install or not only after
CostFinalize action. But, conditions are valid only before CostFinalize
action.
So, I have written a CustomAction to check for this after CostFinalize
action. I thought of setting a property based on Custom Action and pass
that value to File element Name attribute. [Instead of abc.txt] a
property like [FILEARGS].

So, Is this valid? OR Is there some other way to solve the problem?.


--Thanks


On Thu, Jul 9, 2009 at 4:40 PM, David Watson <dwat...@sdl.com> wrote:

> Hi,
>
> It sounds like you are trying to condifionally install one of two 
> files based on which feature is selected.
>
> If you want to do this you should include both files in your installer

> under separate features, in separate components, possible with a 
> component condition.
>
> Or maybe I didn't understand what you are trying to achieve.
>
> Dave
>
>
> -----Original Message-----
> From: mahesh u [mailto:maheshu.u...@gmail.com]
> Sent: 09 July 2009 11:23
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Conditionally pass the property value to 
> FileElement Name, Source attributes.
>
> The problem I am facing is that I cannot use preprocessor variables 
> for PATHARGS because the selection of feature can only be got in run
time...
> So, I want to set a property only based on feature selection and use 
> it in Source attribute of File element..
>
>
> On Thu, Jul 9, 2009 at 3:14 PM, Sebastian Brand (Instyler Software) <
> wix+us...@instyler.com <wix%2bus...@instyler.com> <
> wix%2bus...@instyler.com <wix%252bus...@instyler.com>>> wrote:
>
> > Hello,
> >
> > The @Source is used by the WiX compiler when creating the .msi file 
> > to
>
> > read the file you want to add to the msi. WiX does not handle any []

> > Properties during compile time - Properties are handled by the MSI 
> > Engine during installation.
> > To achieve your goal use a compiler variable, e.g. "$(var.PATHARGS)"

> > -
>
> > these variables can be set when starting wix and will be handled by 
> > the Preprocessor. See WiX help "Preprocessor" for more.
> >
> >
> > Best regards,
> > Sebastian Brand
> >
> > Instyler Setup - Creating WiX-based MSI installations, elegantly.
> > http://www.instyler.com
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: mahesh u [mailto:maheshu.u...@gmail.com]
> > Sent: July 09, 2009 11:26
> > To: wix-users@lists.sourceforge.net
> > Subject: [WiX-users] Conditionally pass the property value to File 
> > Element Name, Source attributes.
> >
> > I am using Wix Version 2.
> >
> > I have the two features F1 and F2. F2 is a sub component of F1. I 
> > have
>
> > a component C1 which is kept inside F1.
> >
> > The component C1 has a file element like this:
> >
> > <File Id="xyz" Name="abc.txt" Source="C:\abc.txt" />
> >
> > But, the Source attribute path and Name attribute depends on the 
> > Feature which is selected.
> > So, I tried to have a custom action to set a property PATHARGS to 
> > the path based on selection of a feature (F1 or F2) and also 
> > property FILENAME to set appropriate file based on selection of 
> > Feature (F1 or F2).
> >
> > Now, if I redefine File element as
> >
> > <File Id="xyz" Name="[FILENAME]" Source="[PATHARGS]" /> ,
> >
> > the File element is unable to read the property value.
> >
> > So, my questions are:
> >
> > 1) Why are the above mentioned steps not working properly?
> > 2) Is there any other way to pass property values to File Name and 
> > Source element.
> >
> > --thanks..
> >
> > --------------------------------------------------------------------
> > --
> > ------
> > --
> > Enter the BlackBerry Developer Challenge This is your chance to win 
> > up
>
> > to $100,000 in prizes! For a limited time, vendors submitting new 
> > applications to BlackBerry App World(TM) will have the opportunity 
> > to enter the BlackBerry Developer Challenge. See full prize
> >
> > details at: http://p.sf.net/sfu/Challenge 
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
> >
> > --------------------------------------------------------------------
> > --
> > -------- Enter the BlackBerry Developer Challenge This is your 
> > chance to win up to $100,000 in prizes! For a limited time, vendors 
> > submitting new applications to BlackBerry App World(TM) will have 
> > the opportunity to enter the BlackBerry Developer Challenge. See 
> > full prize details at: http://p.sf.net/sfu/Challenge 
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> ----------------------------------------------------------------------
> --
> ------
> Enter the BlackBerry Developer Challenge This is your chance to win up

> to $100,000 in prizes! For a limited time, vendors submitting new 
> applications to BlackBerry App World(TM) will have the opportunity to 
> enter the BlackBerry Developer Challenge. See full prize details at:
> http://p.sf.net/sfu/Challenge
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> SDL PLC confidential, all rights reserved.
> If you are not the intended recipient of this mail SDL requests and 
> requires that you delete it without acting upon or copying any of its 
> contents, and we further request that you advise us.
> SDL PLC is a public limited company registered in England and Wales.
>  Registered number: 02675207.
> Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire

> SL6 7DY, UK.
>
>
>
> ----------------------------------------------------------------------
> -------- Enter the BlackBerry Developer Challenge This is your chance 
> to win up to $100,000 in prizes! For a limited time, vendors 
> submitting new applications to BlackBerry App World(TM) will have the 
> opportunity to enter the BlackBerry Developer Challenge. See full 
> prize details at: http://p.sf.net/sfu/Challenge 
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge This is your chance to win up
to $100,000 in prizes! For a limited time, vendors submitting new
applications to BlackBerry App World(TM) will have the opportunity to
enter the BlackBerry Developer Challenge. See full prize details at:
http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to