0

`Hi, I have three components(files). One should be installed whatsoever, and for the other two, only one should be installed based on a registry key value. Unfortunately, I am not making any progress with it (dosens of attempts due to real ducumetation for the v4 version, despite the huge difference between versions..).

This is my code (replaced all guids and long ids with ... to ease the reading):

< Fragment >
< Property Id = "CTRLTYPE" Secure = "yes" >
< RegistrySearch Id = "CTRLRInstalledSearch"
  Root = "HKLM"
  Key = "SOFTWARE\Promise\Agadir\Params"
  Name = "CtrlType" < !--the registry string value to check-->
  Type="raw" />
</Property>
<Directory Id="INSTALLFOLDER" Name="OperationRaf" >
  <Directory Id="dir_..." Name="Raf">
   <Component Id="comp_....." Guid="....">
    <File Id="file_..."  Checksum="yes" 
     KeyPath="yes" Source="..\\Release\Gentor.exe" />
   </Component>
   <Component Id="comp_..." Guid="...">
   <File Id="file_..." Checksum="yes" 
    KeyPath="yes" Source="..\\Release\Punker.exe" />
   </Component>
   <!-- if the registry string value is "Rogis" install component-->
   <Component Id="comp_..." Guid="...." Condition="CTRLTYPE=Rogis">   
     <File Id="file_..."  Source="..\\Release\Rogis.exe" />
   </Component>
   <!-- if the registry string value is "Archa" install component-->
   <Component Id="comp_..." Guid="..."   Condition="CTRLTYPE=Archa"> 
     <File Id="file_..."  Source="..\\Release\Archa.exe"  />
   </Component>           
  </Directory>
 </Directory>
</Fragment>

But my attempts to use the same method as v3for a condition ![CDATA[CONTROLLER_TYPE = "rogis"]] failed. That's my code, can you let me know if this is a known bug or what should I do to make this conditional component install? When copied the same condition or any combination of it it did not work. Please help...

1 Answers1

0

You need to wrap the string literal in quotes like Condition="CTRLTYPE=&quot;Rogis&quot;". I also reccomend case insensive ~= operator. Finally you may need to mark the components as transitive if you expect a repair to change which components are installed if the registry entry has changed.

Finally a simpler solution is to always install both files and then during execution of your app read the registry and decide which one to call.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100