2

Inside my main .wxs, I have components like:

  <Component Id="Component1" Guid="FBE06968-502C-4FFB-82F8-A314AD7D5789" Directory="INSTALLFOLDER">
    <Condition>$(var.CheckBoxB3)=1</Condition>
    <File Name="File.dll" Source="$(var.BinDir)File.dll" />
  </Component>

And it's working fine. The file is installed with a checkbox is checked.

I decide to add all files from a specific directory using heat.exe.

1 - I added the generated .wxs file in my project

2 - I added the good id inside the Directory elements

3 - I added a new feature inside the same feature containing my elements, here it's my new feature:

  <Feature Id="ProductFeatureExamples" Title="Examples" Level="1">
    <Condition Level="1">$(var.CheckBoxB3)=1</Condition>
    <ComponentGroupRef Id="ExamplesComponents"/>
  </Feature>

The good part: All the files inside the generated .wxs are installed.

The bad part: The condition is not working. The files are always installed.

I try to understand why my condition is not working? It's the same condition as the one in the previous components.

I dont want to add condition in all element in the generated .wxs file because there is a lot of them and also it's not very usefull when I need to regenerate the file.

Anyone have an idea?

Thanks.

PatrickB
  • 313
  • 3
  • 14

1 Answers1

2

I found the solution. I was not understaning correctly the way to use the condition with Features. I change the condition line by:

<Condition Level="0">$(var.CheckBoxB3)=""</Condition>

For my case it means: change this feature to level 0(do not use this feature) if the checkbox has no value (not checked).

It's not clear for me how to say: $(var.CheckBoxB3) not equal to 1

<> Is not workign because it's inside a XML

! means another thing

!= do not exist

Any idea someone?

PatrickB
  • 313
  • 3
  • 14
  • 1
    You have two options for the condition: <![CDATA[$(var.CheckBoxB3)<>"1"]]>, or $(var.CheckBoxB3)<>"1". – jbudreau Apr 08 '15 at 17:37